Skip to content

Commit

Permalink
Changed aws ec2 to spot instances (arriven#213)
Browse files Browse the repository at this point in the history
A Spot Instance is an instance that uses spare EC2 capacity that is available for less than the On-Demand price.

We can use this type because it's safe and even good to recreate instances in our case (new external IP and latest docker image).
  • Loading branch information
golubovskyi authored Mar 7, 2022
1 parent c9772bf commit a47ee74
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions terraform/aws/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,9 @@ resource "aws_launch_template" "example" {
image_id = data.aws_ami.latest_amazon_linux.id
instance_initiated_shutdown_behavior = "terminate"
instance_type = var.instance_type
instance_market_options {
market_type = "spot"
}
user_data = base64encode(<<EOF
#!/bin/bash -xe
exec > >(tee /var/log/user-data.log|logger -t user-data -s 2>/dev/console) 2>&1
Expand Down

0 comments on commit a47ee74

Please sign in to comment.