sparse-gold-10561
04/26/2023, 4:51 PMbillowy-army-68599
04/26/2023, 5:25 PMred-flower-37420
04/27/2023, 12:51 PM"""Testing Multi-Volume AMIs and Post-Deploy Volume Resizing"""
import pulumi
import pulumi_aws as aws
ubuntu_ami = aws.ec2.get_ami(most_recent=True,
filters=[
aws.ec2.GetAmiFilterArgs(
name="name",
values=["ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*"],
),
aws.ec2.GetAmiFilterArgs(
name="virtualization-type",
values=["hvm"],
),
],
owners=["099720109477"])
# Create an instance with an addditional volume
test_ami_origin = aws.ec2.Instance(
"test_ami_origin",
ami=ubuntu_ami.id,
instance_type="t3.micro",
tags={"Name": "test_ami_origin",},
ebs_block_devices=[
aws.ec2.InstanceEbsBlockDeviceArgs(
device_name="/dev/sdc",
volume_size=200,
volume_type="gp2",
)
],
subnet_id="subnet-014a297abc46f0170"
)
# Create an AMI from that instance
prod_ppgdb_ami = aws.ec2.AmiFromInstance(
"prod_ppgdb_ami",
source_instance_id=test_ami_origin.id,
)
# First, create a new instance from that AMI,
# Then, uncomment the ebs_block_devices attribute and `pulumi up` again.
# This will trigger replacement of the entire instance, instead of resizing the drive.
test_instance_from_ami = aws.ec2.Instance(
"test_instance_from_ami",
ami=prod_ppgdb_ami.id,
instance_type="t3.micro",
subnet_id="subnet-014a297abc46f0170",
# ebs_block_devices=[
# aws.ec2.InstanceEbsBlockDeviceArgs(
# device_name="/dev/sdc",
# volume_size=250,
# volume_type="gp2",
# )]
)
sparse-gold-10561
04/27/2023, 1:35 PMred-flower-37420
04/27/2023, 3:17 PMcold-minister-39214
05/01/2023, 2:12 PM