如何重命名 ec2-instance 名称

Ash*_*rpe 6 amazon-ec2 amazon-web-services aws-cli

我想使用 cli 重命名 100 个 ec2 实例怎么做?

这将显示所有实例名称:

aws ec2 describe-instances --filters "Name=tag:productionpriority,Values=productionpriority" --query 'Reservations[].Instances[].[ [Tags[?Key==`Name`].Value][0][0],PublicIpAddress, PrivateIpAddress, InstanceId, InstanceType, Placement.AvailabilityZone]'
Run Code Online (Sandbox Code Playgroud)

但是如何修改实例名称,即用新名称替换旧名称?

Ash*_*rpe 6

这对我有用:

ec2-create-tags  i-xxxx --tag "Name=PROD-DEL-xxx"
Run Code Online (Sandbox Code Playgroud)

  • 截至 18 年 4 月,以下命令对我有用:`aws ec2 create-tags --resources i-xxx --tag "Key=Name,Value=PROD-DEL-xxx"` (4认同)