# Gather instance details
# ID of the AMI (Amazon Machine Image) that the VM will use for OS
`# This is the ami for Window Server 2012 R2 64-bit
ami_id = ami-3d787d57
# IDs of the Security Groups to be assign to the VM
security_group_ids = []
# Single subnet id in which VM will be started
subnet_id =
# Key file that will be used to decrypt the administrator password
keyfile_name =
# ARN of the IAM instance profile to be assigned to the VM
iam_profile_arn = 'arn:aws:iam::123456789012:instance-profiel/myprofile
# VM instance type / instance size
instance_type = 't2.micro'
# Disk drive capacity in GB
disk_size = 120
# UserData. Code block to execute on first instance launch
user_data = ' '
# Create the instance
ec2.create_instances(
ImageId = ami_id,
MinCount = 1,
MaxCount = 1,
KeyName = keyfile_name,
SecurityGroupIds = security_group_ids,
InstanceType = instance_type,
BlockDeviceMappings = [
{
'DeviceName': '/dev/sda1',
'Ebs': {
'VolumeSize': disk_size,
'DeleteOnTermination': True,
'VolumeType': 'gp2',
}
],
IamInstanceProfile = {
'Arn': arn_profile
},
SubnetId = subnet_id,
UserData = user_data
)