是否可以使用 CLI 创建和 Auto Scaling Group Launch 配置并在一个命令中定义实例标签?
Is it possible to create and Auto Scaling Group Launch config with the CLI and define the instance tags in one command?
是否可以使用 CLI 创建 Auto Scaling Group Launch 配置并在一条命令中定义实例标签?
也许我遗漏了什么,但现在看来必须分两步完成。
即
aws autoscaling create-launch-configuration ...
然后是
aws autoscaling create-or-update-tags --tags ...
由于您需要先创建 asg LC 才能对其进行标记,因此如您所述,这是两个步骤的过程。
https://docs.aws.amazon.com/cli/latest/reference/autoscaling/create-launch-configuration.html
此示例基于现有实例创建启动配置。此外,它还指定启动配置属性,例如安全组、租赁、Amazon EBS 优化和引导脚本:
https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-tagging.html
aws autoscaling create-launch-configuration --launch-configuration-name my-launch-config --key-name my-key-pair --instance-id i-7e13c876 --security-groups sg-eb2af88e --instance-type m1.small --user-data file://myuserdata.txt --instance-monitoring Enabled=true --no-ebs-optimized --no-associate-public-ip-address --placement-tenancy dedicated --iam-instance-profile my-autoscaling-role
aws autoscaling create-or-update-tags --tags "ResourceId=my-asg,ResourceType=auto-scaling-group,Key=environment,Value=test,PropagateAtLaunch=true"
是否可以使用 CLI 创建 Auto Scaling Group Launch 配置并在一条命令中定义实例标签?
也许我遗漏了什么,但现在看来必须分两步完成。
即
aws autoscaling create-launch-configuration ...
然后是
aws autoscaling create-or-update-tags --tags ...
由于您需要先创建 asg LC 才能对其进行标记,因此如您所述,这是两个步骤的过程。 https://docs.aws.amazon.com/cli/latest/reference/autoscaling/create-launch-configuration.html
此示例基于现有实例创建启动配置。此外,它还指定启动配置属性,例如安全组、租赁、Amazon EBS 优化和引导脚本:
https://docs.aws.amazon.com/autoscaling/ec2/userguide/autoscaling-tagging.html
aws autoscaling create-launch-configuration --launch-configuration-name my-launch-config --key-name my-key-pair --instance-id i-7e13c876 --security-groups sg-eb2af88e --instance-type m1.small --user-data file://myuserdata.txt --instance-monitoring Enabled=true --no-ebs-optimized --no-associate-public-ip-address --placement-tenancy dedicated --iam-instance-profile my-autoscaling-role
aws autoscaling create-or-update-tags --tags "ResourceId=my-asg,ResourceType=auto-scaling-group,Key=environment,Value=test,PropagateAtLaunch=true"