ambitious-afternoon-55254
07/21/2021, 3:52 PMtags_all
doesn’t seem to do anything in my tests.
2. When I delete the resource (remove the code from pulumi and pulumi up
) — the spot request is cancelled, but the underlying EC2 instance continues to run. How do I get pulumi to shut down the EC2 instance as well?
import pulumi
import pulumi_aws as aws
test_instance = aws.ec2.SpotInstanceRequest(
"test_spot_instance",
ami="ami-09e67e426f25ce0d7",
spot_price='0.55',
spot_type='one-time',
subnet_id='subnet-302a5579',
associate_public_ip_address=True,
ebs_optimized=True,
ebs_block_devices=[ebs],
iam_instance_profile="ecsInstanceRole",
instance_type="m5.xlarge",
key_name="test-keypair",
source_dest_check=True,
tags={
"Name": "TestSpot",
},
tags_all={
"Name": "TestSpotAll",
"tags_all": "yes",
},
)
bumpy-grass-54508
07/21/2021, 5:06 PMLaunchTemplate
and then a AutoScalingGroup
that references the template. your ASG can say it wants X number of instances and will do its best to keep that many spot instances up and running (depending on your spot price limit which you can control). then when you delete the ASG it will also remove the instances it has under its controlTagSpecifications
where you can specify certain tags that will get applied to the instances, the volumes, and the spot-instance-requests all seperatelyspot fleet
/ ec2-fleet
/ spot-requests
/ and autoscaling groups
but for my current use cases, autoscaling groups (with spot instances) is the best option for me. instance weighting, keeping capacity at a certain amount, and using spot pricing make for a good timegreat-sunset-355
07/22/2021, 9:45 AM