【发布时间】:2022-01-11 16:08:40
【问题描述】:
我有之前创建的 AutoScale 和 LaunchConfig。我想在 LaunchConfig 中用 Cloudformation 替换 AMI ID。我该怎么做?
我想知道是否有任何示例模板可供我参考?
【问题讨论】:
标签: amazon-web-services amazon-cloudformation
我有之前创建的 AutoScale 和 LaunchConfig。我想在 LaunchConfig 中用 Cloudformation 替换 AMI ID。我该怎么做?
我想知道是否有任何示例模板可供我参考?
【问题讨论】:
标签: amazon-web-services amazon-cloudformation
---
AWSTemplateFormatVersion: 2010-09-09
Parameters:
LatestAmiId:
Description: Region specific image from the Parameter Store
Type: 'AWS::SSM::Parameter::Value<AWS::EC2::Image::Id>'
Default: '/aws/service/ami-amazon-linux-latest/amzn2-ami-hvm-x86_64-gp2'
InstanceType:
Description: Amazon EC2 instance type for the instances
Type: String
AllowedValues:
- t3.micro
- t3.small
- t3.medium
Default: t3.micro
Resources:
myLaunchConfig:
Type: AWS::AutoScaling::LaunchConfiguration
Properties:
ImageId: !Ref LatestAmiId
SecurityGroups:
- Ref: "myEC2SecurityGroup"
InstanceType:
Ref: "InstanceType"
BlockDeviceMappings:
- DeviceName: /dev/sda1
Ebs:
VolumeSize: 30
VolumeType: "gp3"
- DeviceName: /dev/sdm
Ebs:
VolumeSize: 100
DeleteOnTermination: "false"
【讨论】: