SlideShare a Scribd company logo
1 of 35
Communit
y
AWS Community
How To Save Resources With the
Terraform Module for AWS Spot
Instances
Vladimir Cageyv Samoylov
AWS Community
Key Takeaway
- What is EC2 Spot Instances and how it works
- The true cost of Spot Instances
- How we could programmatically get the max-price value
A Christmas Story and Huge Demand
for EC2
AWS Community
A December Surprise: Double the Payment for
AWS Spot Instances
Amazon EC2 Spot Instances
Who are you?
AWS EC2 Spot Instance = Unused
EC2 at a low price
More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances.html
Interrupt readiness
AWS Community
2 minute termination notice. EC2 meta-data and
EventBridge
More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-instance-termination-
notices.html
AWS Community
The Fault Injection Simulator can simulate
termination notices
More info: https://aws.amazon.com/fis/
Resilience and Elasticity with EC2
Auto Scaling Group
Using different Instance Types and
AZs increases launch chances
Spot Instance Advisor
More info: https://aws.amazon.com/ec2/spot/instance-advisor/
AWS Community
Spot Instance Advisor. Example
Allocation strategies for Spot Instances
More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-allocation-
strategy.html
AWS Community
Allocation strategies for Spot Instances
- price-capacity-optimized !!!
- capacity-optimized
- lowest-price
More info: https://aws.amazon.com/blogs/compute/introducing-price-capacity-optimized-
allocation-strategy-for-ec2-spot-instances/
Resilience with Capacity rebalance.
Get new EC2 in advance.
More info: https://ec2spotworkshops.com/ec2-auto-scaling-with-multiple-instance-types-and-
purchase-options/spot_resilience.html
AWS Community
EC2 Autoscaling Capacity rebalance
More info: https://github.com/awslabs/ec2-spot-labs/tree/master/ec2-spot-interruption-handler
Spot Instance Pricing
How much will I have to pay?
AWS Community
Cost Explorer
AWS Community
Spot Instance data feed
More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html
Charge = Spot Price
Spot Instance pricing history
More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances-
history.html
AWS Community
Spot price history (example from docs)
AWS Community
Spot price history (December expectations)
Spot Max Price
More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html#using-
spot-instances-request (step 10 in new console example)
What will happen if the Spot Max Price
is not specified?
More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html#using-
spot-instances-request (step 10 in new console example)
What next? No more Spot Instances?
AWS Community
AWS CLI: aws ec2 describe-spot-price-history
More info: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe-
spot-price-history.html
AWS Community
AWS API: EC2 DescribeSpotPriceHistory
More info:
https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSpotPriceHistory.html
AWS Community
Terraform Module: ec2-spot-price
More info: https://github.com/fivexl/terraform-aws-ec2-spot-price
AWS Community
Initial data
AZ  Type r5.2xlarge r5d.2xlarge r5a.2xlarge
eu-central-1a 0.20 0.20 0.20
eu-central-1b 0.20 0.15 0.10
eu-central-1c 0.20 0.30 0.25
*These prices are not real prices for EC2 Spot Instance
AWS Community
Example: All Instance Types in all AZs with
increased reliability.
module "ec2_spot_price" {
source = "fivexl/ec2-spot-price/aws"
version = "2.0.0"
instance_types_list = ["r5.2xlarge", "r5d.2xlarge", "r5a.2xlarge"]
availability_zones_names_list = ["eu-central-1a", "eu-central-1b", "eu-central-1c"]
сustom_price_modifier = 1.1
}
output "spot_price_current_max_mod" {
value = module.ec2_spot_price.spot_price_current_max_mod
}
Result: 0.33
AWS Community
Example: Cheapest as possible
module "ec2_spot_price" {
source = "fivexl/ec2-spot-price/aws"
version = "2.0.0"
instance_types_list = ["r5.2xlarge", "r5d.2xlarge", "r5a.2xlarge"]
availability_zones_names_list = ["eu-central-1a", "eu-central-1b", "eu-central-1c"]
}
output "spot_price_current_max_mod" {
value = module.ec2_spot_price.spot_price_current_min
}
Result: 0.10
EC2 Spot Instances use cases
Thank you
Contacts:
● https://t.me/cageyv
● https://cageyv.dev/
● https://github.com/cageyv/
● https://www.linkedin.com/in/vladimirsamoylov
/
Useful links:
● https://github.com/fivexl/terraform-aws-ec2-
spot-price
● https://aws.amazon.com/ru/ec2/spot/instance-
advisor/
● https://ec2spotworkshops.com/
● https://github.com/awslabs/ec2-spot-labs/
● https://github.com/aws/aws-node-
termination-handler
● https://docs.aws.amazon.com/AmazonECS/late
st/developerguide/container-instance-
spot.html

More Related Content

What's hot

온라인 교육 시리즈 - 클라우드 기반의 마이데이터사업 혁신(김민형 클라우드 솔루션 아키텍트)
온라인 교육 시리즈 - 클라우드 기반의 마이데이터사업 혁신(김민형 클라우드 솔루션 아키텍트) 온라인 교육 시리즈 - 클라우드 기반의 마이데이터사업 혁신(김민형 클라우드 솔루션 아키텍트)
온라인 교육 시리즈 - 클라우드 기반의 마이데이터사업 혁신(김민형 클라우드 솔루션 아키텍트) NAVER CLOUD PLATFORMㅣ네이버 클라우드 플랫폼
 
한글과컴퓨터의 클라우드 마이그레이션, 거버넌스 그리고 모더나이제이션-박인재, AWS ISV SA Manager / 박상형, 한글과컴퓨터 I...
한글과컴퓨터의 클라우드 마이그레이션, 거버넌스 그리고 모더나이제이션-박인재, AWS ISV SA Manager / 박상형, 한글과컴퓨터 I...한글과컴퓨터의 클라우드 마이그레이션, 거버넌스 그리고 모더나이제이션-박인재, AWS ISV SA Manager / 박상형, 한글과컴퓨터 I...
한글과컴퓨터의 클라우드 마이그레이션, 거버넌스 그리고 모더나이제이션-박인재, AWS ISV SA Manager / 박상형, 한글과컴퓨터 I...Amazon Web Services Korea
 
捕鯨!詳解docker
捕鯨!詳解docker捕鯨!詳解docker
捕鯨!詳解docker雄哉 吉田
 
Autenticación de usuarios proxy pfsense 2.1
Autenticación de usuarios proxy pfsense 2.1Autenticación de usuarios proxy pfsense 2.1
Autenticación de usuarios proxy pfsense 2.1Mauricio Arcas H.
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험NHN FORWARD
 
Edge Computing Use Cases: Interactive Deep Dive on AWS Snowball Edge (STG387)...
Edge Computing Use Cases: Interactive Deep Dive on AWS Snowball Edge (STG387)...Edge Computing Use Cases: Interactive Deep Dive on AWS Snowball Edge (STG387)...
Edge Computing Use Cases: Interactive Deep Dive on AWS Snowball Edge (STG387)...Amazon Web Services
 
Kubernetes + Python = ❤ - Cloud Native Prague
Kubernetes + Python = ❤ - Cloud Native PragueKubernetes + Python = ❤ - Cloud Native Prague
Kubernetes + Python = ❤ - Cloud Native PragueHenning Jacobs
 
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...Amazon Web Services Korea
 
[IDG Tech Webinar] “클라우드 비용, 더 아낄 수 있다” 실전 클라우드 비용 최적화 가이드
[IDG Tech Webinar] “클라우드 비용, 더 아낄 수 있다” 실전 클라우드 비용 최적화 가이드[IDG Tech Webinar] “클라우드 비용, 더 아낄 수 있다” 실전 클라우드 비용 최적화 가이드
[IDG Tech Webinar] “클라우드 비용, 더 아낄 수 있다” 실전 클라우드 비용 최적화 가이드BESPIN GLOBAL
 
AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for ...
AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for ...AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for ...
AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for ...Amazon Web Services
 
Getting Started with Amazon Database Migration Service
Getting Started with Amazon Database Migration ServiceGetting Started with Amazon Database Migration Service
Getting Started with Amazon Database Migration ServiceAmazon Web Services
 
Deep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech Talks
Deep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech TalksDeep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech Talks
Deep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech TalksAmazon Web Services
 
Migrating Your AD to the Cloud with AWS Directory Services for Microsoft Acti...
Migrating Your AD to the Cloud with AWS Directory Services for Microsoft Acti...Migrating Your AD to the Cloud with AWS Directory Services for Microsoft Acti...
Migrating Your AD to the Cloud with AWS Directory Services for Microsoft Acti...Amazon Web Services
 
Adopting Multi-Cloud Services with Confidence
Adopting Multi-Cloud Services with ConfidenceAdopting Multi-Cloud Services with Confidence
Adopting Multi-Cloud Services with ConfidenceKevin Hakanson
 
AWS CLOUD 2017 - Amazon Aurora를 통한 고성능 데이터베이스 운용하기 (박선용 솔루션즈 아키텍트)
AWS CLOUD 2017 - Amazon Aurora를 통한 고성능 데이터베이스 운용하기 (박선용 솔루션즈 아키텍트)AWS CLOUD 2017 - Amazon Aurora를 통한 고성능 데이터베이스 운용하기 (박선용 솔루션즈 아키텍트)
AWS CLOUD 2017 - Amazon Aurora를 통한 고성능 데이터베이스 운용하기 (박선용 솔루션즈 아키텍트)Amazon Web Services Korea
 
현대백화점 리테일테크랩과 AWS Prototyping 팀 개발자가 들려주는 인공 지능 무인 스토어 개발 여정 - 최권열 AWS 프로토타이핑...
현대백화점 리테일테크랩과 AWS Prototyping 팀 개발자가 들려주는 인공 지능 무인 스토어 개발 여정 - 최권열 AWS 프로토타이핑...현대백화점 리테일테크랩과 AWS Prototyping 팀 개발자가 들려주는 인공 지능 무인 스토어 개발 여정 - 최권열 AWS 프로토타이핑...
현대백화점 리테일테크랩과 AWS Prototyping 팀 개발자가 들려주는 인공 지능 무인 스토어 개발 여정 - 최권열 AWS 프로토타이핑...Amazon Web Services Korea
 
대용량 데이터레이크 마이그레이션 사례 공유 [카카오게임즈 - 레벨 200] - 조은희, 팀장, 카카오게임즈 ::: Games on AWS ...
대용량 데이터레이크 마이그레이션 사례 공유 [카카오게임즈 - 레벨 200] - 조은희, 팀장, 카카오게임즈 ::: Games on AWS ...대용량 데이터레이크 마이그레이션 사례 공유 [카카오게임즈 - 레벨 200] - 조은희, 팀장, 카카오게임즈 ::: Games on AWS ...
대용량 데이터레이크 마이그레이션 사례 공유 [카카오게임즈 - 레벨 200] - 조은희, 팀장, 카카오게임즈 ::: Games on AWS ...Amazon Web Services Korea
 
IAM Introduction and Best Practices
IAM Introduction and Best PracticesIAM Introduction and Best Practices
IAM Introduction and Best PracticesAmazon Web Services
 

What's hot (20)

온라인 교육 시리즈 - 클라우드 기반의 마이데이터사업 혁신(김민형 클라우드 솔루션 아키텍트)
온라인 교육 시리즈 - 클라우드 기반의 마이데이터사업 혁신(김민형 클라우드 솔루션 아키텍트) 온라인 교육 시리즈 - 클라우드 기반의 마이데이터사업 혁신(김민형 클라우드 솔루션 아키텍트)
온라인 교육 시리즈 - 클라우드 기반의 마이데이터사업 혁신(김민형 클라우드 솔루션 아키텍트)
 
한글과컴퓨터의 클라우드 마이그레이션, 거버넌스 그리고 모더나이제이션-박인재, AWS ISV SA Manager / 박상형, 한글과컴퓨터 I...
한글과컴퓨터의 클라우드 마이그레이션, 거버넌스 그리고 모더나이제이션-박인재, AWS ISV SA Manager / 박상형, 한글과컴퓨터 I...한글과컴퓨터의 클라우드 마이그레이션, 거버넌스 그리고 모더나이제이션-박인재, AWS ISV SA Manager / 박상형, 한글과컴퓨터 I...
한글과컴퓨터의 클라우드 마이그레이션, 거버넌스 그리고 모더나이제이션-박인재, AWS ISV SA Manager / 박상형, 한글과컴퓨터 I...
 
捕鯨!詳解docker
捕鯨!詳解docker捕鯨!詳解docker
捕鯨!詳解docker
 
AWS Route53
AWS Route53AWS Route53
AWS Route53
 
Autenticación de usuarios proxy pfsense 2.1
Autenticación de usuarios proxy pfsense 2.1Autenticación de usuarios proxy pfsense 2.1
Autenticación de usuarios proxy pfsense 2.1
 
[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험[2018] 오픈스택 5년 운영의 경험
[2018] 오픈스택 5년 운영의 경험
 
Edge Computing Use Cases: Interactive Deep Dive on AWS Snowball Edge (STG387)...
Edge Computing Use Cases: Interactive Deep Dive on AWS Snowball Edge (STG387)...Edge Computing Use Cases: Interactive Deep Dive on AWS Snowball Edge (STG387)...
Edge Computing Use Cases: Interactive Deep Dive on AWS Snowball Edge (STG387)...
 
Kubernetes + Python = ❤ - Cloud Native Prague
Kubernetes + Python = ❤ - Cloud Native PragueKubernetes + Python = ❤ - Cloud Native Prague
Kubernetes + Python = ❤ - Cloud Native Prague
 
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...
Amazon Elasticache - Fully managed, Redis & Memcached Compatible Service (Lev...
 
[IDG Tech Webinar] “클라우드 비용, 더 아낄 수 있다” 실전 클라우드 비용 최적화 가이드
[IDG Tech Webinar] “클라우드 비용, 더 아낄 수 있다” 실전 클라우드 비용 최적화 가이드[IDG Tech Webinar] “클라우드 비용, 더 아낄 수 있다” 실전 클라우드 비용 최적화 가이드
[IDG Tech Webinar] “클라우드 비용, 더 아낄 수 있다” 실전 클라우드 비용 최적화 가이드
 
AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for ...
AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for ...AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for ...
AWS re:Invent 2016: Workshop: Using the Database Migration Service (DMS) for ...
 
Getting Started with Amazon Database Migration Service
Getting Started with Amazon Database Migration ServiceGetting Started with Amazon Database Migration Service
Getting Started with Amazon Database Migration Service
 
Deep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech Talks
Deep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech TalksDeep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech Talks
Deep Dive on Amazon EBS Elastic Volumes - March 2017 AWS Online Tech Talks
 
Migrating Your AD to the Cloud with AWS Directory Services for Microsoft Acti...
Migrating Your AD to the Cloud with AWS Directory Services for Microsoft Acti...Migrating Your AD to the Cloud with AWS Directory Services for Microsoft Acti...
Migrating Your AD to the Cloud with AWS Directory Services for Microsoft Acti...
 
Adopting Multi-Cloud Services with Confidence
Adopting Multi-Cloud Services with ConfidenceAdopting Multi-Cloud Services with Confidence
Adopting Multi-Cloud Services with Confidence
 
Serverless
ServerlessServerless
Serverless
 
AWS CLOUD 2017 - Amazon Aurora를 통한 고성능 데이터베이스 운용하기 (박선용 솔루션즈 아키텍트)
AWS CLOUD 2017 - Amazon Aurora를 통한 고성능 데이터베이스 운용하기 (박선용 솔루션즈 아키텍트)AWS CLOUD 2017 - Amazon Aurora를 통한 고성능 데이터베이스 운용하기 (박선용 솔루션즈 아키텍트)
AWS CLOUD 2017 - Amazon Aurora를 통한 고성능 데이터베이스 운용하기 (박선용 솔루션즈 아키텍트)
 
현대백화점 리테일테크랩과 AWS Prototyping 팀 개발자가 들려주는 인공 지능 무인 스토어 개발 여정 - 최권열 AWS 프로토타이핑...
현대백화점 리테일테크랩과 AWS Prototyping 팀 개발자가 들려주는 인공 지능 무인 스토어 개발 여정 - 최권열 AWS 프로토타이핑...현대백화점 리테일테크랩과 AWS Prototyping 팀 개발자가 들려주는 인공 지능 무인 스토어 개발 여정 - 최권열 AWS 프로토타이핑...
현대백화점 리테일테크랩과 AWS Prototyping 팀 개발자가 들려주는 인공 지능 무인 스토어 개발 여정 - 최권열 AWS 프로토타이핑...
 
대용량 데이터레이크 마이그레이션 사례 공유 [카카오게임즈 - 레벨 200] - 조은희, 팀장, 카카오게임즈 ::: Games on AWS ...
대용량 데이터레이크 마이그레이션 사례 공유 [카카오게임즈 - 레벨 200] - 조은희, 팀장, 카카오게임즈 ::: Games on AWS ...대용량 데이터레이크 마이그레이션 사례 공유 [카카오게임즈 - 레벨 200] - 조은희, 팀장, 카카오게임즈 ::: Games on AWS ...
대용량 데이터레이크 마이그레이션 사례 공유 [카카오게임즈 - 레벨 200] - 조은희, 팀장, 카카오게임즈 ::: Games on AWS ...
 
IAM Introduction and Best Practices
IAM Introduction and Best PracticesIAM Introduction and Best Practices
IAM Introduction and Best Practices
 

Similar to AWS Spot Pricing with Terraform [ENG 2023]

(CMP311) This One Weird API Request Will Save You Thousands
(CMP311) This One Weird API Request Will Save You Thousands(CMP311) This One Weird API Request Will Save You Thousands
(CMP311) This One Weird API Request Will Save You ThousandsAmazon Web Services
 
AWS March 2016 Webinar Series - Amazon EC2 Masterclass
AWS March 2016 Webinar Series - Amazon EC2 MasterclassAWS March 2016 Webinar Series - Amazon EC2 Masterclass
AWS March 2016 Webinar Series - Amazon EC2 MasterclassAmazon Web Services
 
Amazon EC2 - Masterclass - Pop-up Loft Tel Aviv
Amazon EC2 - Masterclass - Pop-up Loft Tel AvivAmazon EC2 - Masterclass - Pop-up Loft Tel Aviv
Amazon EC2 - Masterclass - Pop-up Loft Tel AvivAmazon Web Services
 
StartPad Countdown 8 - Amazon Web Services and You
StartPad Countdown 8 - Amazon Web Services and YouStartPad Countdown 8 - Amazon Web Services and You
StartPad Countdown 8 - Amazon Web Services and YouStart Pad
 
A 60-minute tour of AWS Compute (November 2016)
A 60-minute tour of AWS Compute (November 2016)A 60-minute tour of AWS Compute (November 2016)
A 60-minute tour of AWS Compute (November 2016)Julien SIMON
 
AWS Cost Control
AWS Cost ControlAWS Cost Control
AWS Cost ControlBob Brown
 
AWS Atlanta Meetup -AWS Spot Blocks and Spot Fleet
AWS Atlanta Meetup -AWS Spot Blocks and Spot FleetAWS Atlanta Meetup -AWS Spot Blocks and Spot Fleet
AWS Atlanta Meetup -AWS Spot Blocks and Spot FleetAdam Book
 
Amazon cloud intance launch3
Amazon cloud intance launch3Amazon cloud intance launch3
Amazon cloud intance launch3Zenita Smythe
 
Amazon cloud intance launch3
Amazon cloud intance launch3Amazon cloud intance launch3
Amazon cloud intance launch3Zenita Smythe
 
Amazon cloud intance launch
Amazon cloud intance launchAmazon cloud intance launch
Amazon cloud intance launchZenita Smythe
 
Introduction to EC2
Introduction to EC2Introduction to EC2
Introduction to EC2Mark Squires
 
An introduction to Spot Instances and AWS Fleet - Webinar
An introduction to Spot Instances and AWS Fleet - WebinarAn introduction to Spot Instances and AWS Fleet - Webinar
An introduction to Spot Instances and AWS Fleet - WebinarCMPUTE
 
This One Weird API Request Will Save You Thousands
This One Weird API Request Will Save You ThousandsThis One Weird API Request Will Save You Thousands
This One Weird API Request Will Save You ThousandsAmazon Web Services
 
Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...
Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...
Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...Amazon Web Services
 

Similar to AWS Spot Pricing with Terraform [ENG 2023] (20)

Amazon EC2:Masterclass
Amazon EC2:MasterclassAmazon EC2:Masterclass
Amazon EC2:Masterclass
 
(CMP311) This One Weird API Request Will Save You Thousands
(CMP311) This One Weird API Request Will Save You Thousands(CMP311) This One Weird API Request Will Save You Thousands
(CMP311) This One Weird API Request Will Save You Thousands
 
Getting Started with Amazon EC2
Getting Started with Amazon EC2Getting Started with Amazon EC2
Getting Started with Amazon EC2
 
AWS March 2016 Webinar Series - Amazon EC2 Masterclass
AWS March 2016 Webinar Series - Amazon EC2 MasterclassAWS March 2016 Webinar Series - Amazon EC2 Masterclass
AWS March 2016 Webinar Series - Amazon EC2 Masterclass
 
應用開發新思維
應用開發新思維應用開發新思維
應用開發新思維
 
Masterclass Live: Amazon EC2
Masterclass Live: Amazon EC2 Masterclass Live: Amazon EC2
Masterclass Live: Amazon EC2
 
Amazon EC2 Masterclass
Amazon EC2 MasterclassAmazon EC2 Masterclass
Amazon EC2 Masterclass
 
Amazon EC2 - Masterclass - Pop-up Loft Tel Aviv
Amazon EC2 - Masterclass - Pop-up Loft Tel AvivAmazon EC2 - Masterclass - Pop-up Loft Tel Aviv
Amazon EC2 - Masterclass - Pop-up Loft Tel Aviv
 
StartPad Countdown 8 - Amazon Web Services and You
StartPad Countdown 8 - Amazon Web Services and YouStartPad Countdown 8 - Amazon Web Services and You
StartPad Countdown 8 - Amazon Web Services and You
 
A 60-minute tour of AWS Compute (November 2016)
A 60-minute tour of AWS Compute (November 2016)A 60-minute tour of AWS Compute (November 2016)
A 60-minute tour of AWS Compute (November 2016)
 
AWS Cost Control
AWS Cost ControlAWS Cost Control
AWS Cost Control
 
AWS Atlanta Meetup -AWS Spot Blocks and Spot Fleet
AWS Atlanta Meetup -AWS Spot Blocks and Spot FleetAWS Atlanta Meetup -AWS Spot Blocks and Spot Fleet
AWS Atlanta Meetup -AWS Spot Blocks and Spot Fleet
 
Amazon cloud intance launch3
Amazon cloud intance launch3Amazon cloud intance launch3
Amazon cloud intance launch3
 
Amazon cloud intance launch3
Amazon cloud intance launch3Amazon cloud intance launch3
Amazon cloud intance launch3
 
Amazon cloud intance launch
Amazon cloud intance launchAmazon cloud intance launch
Amazon cloud intance launch
 
Introduction to Amazon EC2
Introduction to Amazon EC2Introduction to Amazon EC2
Introduction to Amazon EC2
 
Introduction to EC2
Introduction to EC2Introduction to EC2
Introduction to EC2
 
An introduction to Spot Instances and AWS Fleet - Webinar
An introduction to Spot Instances and AWS Fleet - WebinarAn introduction to Spot Instances and AWS Fleet - Webinar
An introduction to Spot Instances and AWS Fleet - Webinar
 
This One Weird API Request Will Save You Thousands
This One Weird API Request Will Save You ThousandsThis One Weird API Request Will Save You Thousands
This One Weird API Request Will Save You Thousands
 
Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...
Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...
Coding Apps in the Cloud to reduce costs up to 90% - September 2016 Webinar S...
 

Recently uploaded

Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIINhPhngng3
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxraffaeleoman
 
Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Vipesco
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Baileyhlharris
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfSenaatti-kiinteistöt
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lodhisaajjda
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaKayode Fayemi
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatmentnswingard
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoKayode Fayemi
 
Causes of poverty in France presentation.pptx
Causes of poverty in France presentation.pptxCauses of poverty in France presentation.pptx
Causes of poverty in France presentation.pptxCamilleBoulbin1
 
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...Pooja Nehwal
 
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verifiedSector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verifiedDelhi Call girls
 
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Delhi Call girls
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfSkillCertProExams
 
Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalFabian de Rijk
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar TrainingKylaCullinane
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...amilabibi1
 

Recently uploaded (18)

Dreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio IIIDreaming Music Video Treatment _ Project & Portfolio III
Dreaming Music Video Treatment _ Project & Portfolio III
 
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptxChiulli_Aurora_Oman_Raffaele_Beowulf.pptx
Chiulli_Aurora_Oman_Raffaele_Beowulf.pptx
 
Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510Thirunelveli call girls Tamil escorts 7877702510
Thirunelveli call girls Tamil escorts 7877702510
 
ICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdfICT role in 21st century education and it's challenges.pdf
ICT role in 21st century education and it's challenges.pdf
 
My Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle BaileyMy Presentation "In Your Hands" by Halle Bailey
My Presentation "In Your Hands" by Halle Bailey
 
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdfThe workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
The workplace ecosystem of the future 24.4.2024 Fabritius_share ii.pdf
 
lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.lONG QUESTION ANSWER PAKISTAN STUDIES10.
lONG QUESTION ANSWER PAKISTAN STUDIES10.
 
If this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New NigeriaIf this Giant Must Walk: A Manifesto for a New Nigeria
If this Giant Must Walk: A Manifesto for a New Nigeria
 
Dreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video TreatmentDreaming Marissa Sánchez Music Video Treatment
Dreaming Marissa Sánchez Music Video Treatment
 
Uncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac FolorunsoUncommon Grace The Autobiography of Isaac Folorunso
Uncommon Grace The Autobiography of Isaac Folorunso
 
Causes of poverty in France presentation.pptx
Causes of poverty in France presentation.pptxCauses of poverty in France presentation.pptx
Causes of poverty in France presentation.pptx
 
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
Aesthetic Colaba Mumbai Cst Call girls 📞 7738631006 Grant road Call Girls ❤️-...
 
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verifiedSector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
Sector 62, Noida Call girls :8448380779 Noida Escorts | 100% verified
 
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
Busty Desi⚡Call Girls in Sector 51 Noida Escorts >༒8448380779 Escort Service-...
 
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdfAWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
AWS Data Engineer Associate (DEA-C01) Exam Dumps 2024.pdf
 
Digital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of DrupalDigital collaboration with Microsoft 365 as extension of Drupal
Digital collaboration with Microsoft 365 as extension of Drupal
 
Report Writing Webinar Training
Report Writing Webinar TrainingReport Writing Webinar Training
Report Writing Webinar Training
 
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
Bring back lost lover in USA, Canada ,Uk ,Australia ,London Lost Love Spell C...
 

AWS Spot Pricing with Terraform [ENG 2023]

  • 1. Communit y AWS Community How To Save Resources With the Terraform Module for AWS Spot Instances Vladimir Cageyv Samoylov
  • 2. AWS Community Key Takeaway - What is EC2 Spot Instances and how it works - The true cost of Spot Instances - How we could programmatically get the max-price value
  • 3. A Christmas Story and Huge Demand for EC2
  • 4. AWS Community A December Surprise: Double the Payment for AWS Spot Instances
  • 5. Amazon EC2 Spot Instances Who are you?
  • 6. AWS EC2 Spot Instance = Unused EC2 at a low price More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances.html
  • 8. AWS Community 2 minute termination notice. EC2 meta-data and EventBridge More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-instance-termination- notices.html
  • 9. AWS Community The Fault Injection Simulator can simulate termination notices More info: https://aws.amazon.com/fis/
  • 10. Resilience and Elasticity with EC2 Auto Scaling Group
  • 11. Using different Instance Types and AZs increases launch chances
  • 12. Spot Instance Advisor More info: https://aws.amazon.com/ec2/spot/instance-advisor/
  • 13. AWS Community Spot Instance Advisor. Example
  • 14. Allocation strategies for Spot Instances More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-fleet-allocation- strategy.html
  • 15. AWS Community Allocation strategies for Spot Instances - price-capacity-optimized !!! - capacity-optimized - lowest-price More info: https://aws.amazon.com/blogs/compute/introducing-price-capacity-optimized- allocation-strategy-for-ec2-spot-instances/
  • 16. Resilience with Capacity rebalance. Get new EC2 in advance. More info: https://ec2spotworkshops.com/ec2-auto-scaling-with-multiple-instance-types-and- purchase-options/spot_resilience.html
  • 17. AWS Community EC2 Autoscaling Capacity rebalance More info: https://github.com/awslabs/ec2-spot-labs/tree/master/ec2-spot-interruption-handler
  • 18. Spot Instance Pricing How much will I have to pay?
  • 20. AWS Community Spot Instance data feed More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-data-feeds.html
  • 21. Charge = Spot Price
  • 22. Spot Instance pricing history More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/using-spot-instances- history.html
  • 23. AWS Community Spot price history (example from docs)
  • 24. AWS Community Spot price history (December expectations)
  • 25. Spot Max Price More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html#using- spot-instances-request (step 10 in new console example)
  • 26. What will happen if the Spot Max Price is not specified? More info: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/spot-requests.html#using- spot-instances-request (step 10 in new console example)
  • 27. What next? No more Spot Instances?
  • 28. AWS Community AWS CLI: aws ec2 describe-spot-price-history More info: https://awscli.amazonaws.com/v2/documentation/api/latest/reference/ec2/describe- spot-price-history.html
  • 29. AWS Community AWS API: EC2 DescribeSpotPriceHistory More info: https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSpotPriceHistory.html
  • 30. AWS Community Terraform Module: ec2-spot-price More info: https://github.com/fivexl/terraform-aws-ec2-spot-price
  • 31. AWS Community Initial data AZ Type r5.2xlarge r5d.2xlarge r5a.2xlarge eu-central-1a 0.20 0.20 0.20 eu-central-1b 0.20 0.15 0.10 eu-central-1c 0.20 0.30 0.25 *These prices are not real prices for EC2 Spot Instance
  • 32. AWS Community Example: All Instance Types in all AZs with increased reliability. module "ec2_spot_price" { source = "fivexl/ec2-spot-price/aws" version = "2.0.0" instance_types_list = ["r5.2xlarge", "r5d.2xlarge", "r5a.2xlarge"] availability_zones_names_list = ["eu-central-1a", "eu-central-1b", "eu-central-1c"] сustom_price_modifier = 1.1 } output "spot_price_current_max_mod" { value = module.ec2_spot_price.spot_price_current_max_mod } Result: 0.33
  • 33. AWS Community Example: Cheapest as possible module "ec2_spot_price" { source = "fivexl/ec2-spot-price/aws" version = "2.0.0" instance_types_list = ["r5.2xlarge", "r5d.2xlarge", "r5a.2xlarge"] availability_zones_names_list = ["eu-central-1a", "eu-central-1b", "eu-central-1c"] } output "spot_price_current_max_mod" { value = module.ec2_spot_price.spot_price_current_min } Result: 0.10
  • 34. EC2 Spot Instances use cases
  • 35. Thank you Contacts: ● https://t.me/cageyv ● https://cageyv.dev/ ● https://github.com/cageyv/ ● https://www.linkedin.com/in/vladimirsamoylov / Useful links: ● https://github.com/fivexl/terraform-aws-ec2- spot-price ● https://aws.amazon.com/ru/ec2/spot/instance- advisor/ ● https://ec2spotworkshops.com/ ● https://github.com/awslabs/ec2-spot-labs/ ● https://github.com/aws/aws-node- termination-handler ● https://docs.aws.amazon.com/AmazonECS/late st/developerguide/container-instance- spot.html