https://aws.amazon.com/blogs/aws/new-ec2-spot-blocks-for-defined-duration-workloads/
Each Spot Fleet request must contain the following values:
- Target Capacity
- The number of Spot Instances you would want to launch
- Launch Specification
- The types of Spot Instances that you would want to launch and how you want them to be configured (AMI, VPC, subnets, Availability Zones, user data, security groups, and so on)
- Allocation Strategy
- It determines how it fulfills your Spot Fleet request from the possible Spot Instance pools represented by its Launch Specifications
- Lowest price
- Diversified
- It determines how it fulfills your Spot Fleet request from the possible Spot Instance pools represented by its Launch Specifications
- Maximum Bid Price
- The maximum bid price that you are willing to pay for all selected instance types.
- USD is the only accepted currency
Spot Bid Advisor:
https://aws.amazon.com/ec2/spot/bid-advisor/
In a 3 month history m1.small spot price has consistently been below $0.012:
In a 3 month history t1.micro spot price has consistently been below $0.0035... EC2 instance for less than $25/year!!:
aws ec2 describe-spot-price-history --product-description "Linux/UNIX" --instance-types "m1.small" | grep -i SpotPrice | cut -d'"' -f4 | sort
Easy to get a bargain, yet please note m1/t1 instance families are PV
https://github.com/awslabs/aws-spot-labs
bash-3.2$ python get_spot_duration.py \
--region ap-southeast-2 \
--product-description 'Linux/UNIX' \
--bids c3.large:0.05,c3.xlarge:0.105,c3.2xlarge:0.21,c3.4xlarge:0.42,c3.8xlarge:0.84
Easy to create spot fleet:
Can use ELB with Spot fleet:
Can use Autoscaling with Spot Fleet:
New Spot Block up to 6 hours - 30-45% lower cost than on demand instances:
$ aws ec2 request-spot-instances \ --block-duration-minutes 360 \ --instance-count 2 \ --spot-price "0.25" ...
Spot instance gives 2 minute warning before it terminates, can take action such as deregister from ELB:
Sometimes spot price is much higher than on-demand price:
ELB integration:
=> Sample registration script (please update it to match your configuration) :
aws elb register-instances-with-load-balancer \
--load-balancer-name my-loadbalancer
--instances $instance_id;
=> Sample de-registration script (please update it to match your configuration)
$ if curl -s http://169.254.169.254/latest/meta- data/spot/termination-time | \
grep -q .*T.*Z; then instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id); \
aws elb deregister-instances-from-load-balancer \
--load-balancer-name my-load-balancer \
--instances $instance_id; /env/bin/flushsessiontoDBonterminationscript.sh; fi
Update 6/4/2017: State of AWS Spot instance Market
https://spotinst.com/files/white-papers/spotinst-the-state-of-the-amazon-spot-market-white-paper.pdf
ELB integration:
=> Sample registration script (please update it to match your configuration) :
aws elb register-instances-with-load-balancer \
--load-balancer-name my-loadbalancer
--instances $instance_id;
=> Sample de-registration script (please update it to match your configuration)
$ if curl -s http://169.254.169.254/latest/meta- data/spot/termination-time | \
grep -q .*T.*Z; then instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id); \
aws elb deregister-instances-from-load-balancer \
--load-balancer-name my-load-balancer \
--instances $instance_id; /env/bin/flushsessiontoDBonterminationscript.sh; fi
Update 6/4/2017: State of AWS Spot instance Market
https://spotinst.com/files/white-papers/spotinst-the-state-of-the-amazon-spot-market-white-paper.pdf
No comments:
Post a Comment