You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.5 KiB
44 lines
1.5 KiB
6 years ago
|
|
||
|
import utils
|
||
|
|
||
|
|
||
|
def create(config, ec2_client, region_number, instance_type):
|
||
|
return ec2_client.create_launch_template(
|
||
|
# DryRun=True,
|
||
|
LaunchTemplateName='richard-benchmark-' + \
|
||
|
config[region_number][utils.REGION_NAME] + '-' + instance_type,
|
||
|
LaunchTemplateData={
|
||
|
'IamInstanceProfile': {
|
||
|
'Name': utils.IAM_INSTANCE_PROFILE
|
||
|
},
|
||
|
'ImageId': config[region_number][utils.REGION_AMI],
|
||
|
'InstanceType': instance_type,
|
||
|
'KeyName': config[region_number][utils.REGION_KEY],
|
||
|
'UserData': utils.USER_DATA_BASE64,
|
||
|
'SecurityGroupIds': [
|
||
|
config[region_number][utils.REGION_SECURITY_GROUP_ID]
|
||
|
],
|
||
|
# 'InstanceInitiatedShutdownBehavior': 'stop',
|
||
|
# 'TagSpecifications': [
|
||
|
# {
|
||
|
# 'ResourceType': 'instance',
|
||
|
# 'Tags': [
|
||
|
# {
|
||
|
# 'Key': 'Name',
|
||
|
# 'Value': 'string'
|
||
|
# }
|
||
|
# ]
|
||
|
# }
|
||
|
# ],
|
||
|
# 'InstanceMarketOptions': {
|
||
|
# 'MarketType': 'spot',
|
||
|
# 'SpotOptions': {
|
||
|
# 'MaxPrice': 'string',
|
||
|
# 'SpotInstanceType': 'one-time'|'persistent',
|
||
|
# 'BlockDurationMinutes': 123,
|
||
|
# 'InstanceInterruptionBehavior': 'hibernate'|'stop'|'terminate'
|
||
|
# }
|
||
|
# },
|
||
|
}
|
||
|
)
|