Nội dung:
Sử dụng CLI create-tags với tham số –resources và –tags
VD: aws ec2 create-tags –resources ami-78a54011 –tags Key=Stack,Value=production
Sử dụng CLI run-instances để tạo máy ảo mới và dùng tham số –tag-spectifications để khai báo thông tin thẻ
VD:
aws ec2 run-instances \
--image-id ami-abc12345 \
--count 1 \
--instance-type t2.micro \
--key-name MyKeyPair \
--subnet-id subnet-6e7f829e \
--tag-specifications 'ResourceType=instance,Tags=[{Key=cost-center,Value=cc123}]' 'ResourceType=volume,Tags=[{Key=cost-center,Value=cc123}]'
Sử dụng CLI create-volume để tạo volume mới và dùng tham số –tag-specifications để khai báo thông tin thẻ
VD:
aws ec2 create-volume \
--availability-zone us-east-1a \
--volume-type gp2 \
--size 80 \
--tag-specifications 'ResourceType=volume,Tags=[{Key=purpose,Value=production},{Key=cost-center,Value=cc123}]'
Sử dụng CLI derscibe-instances với tham số --filters
VD: aws ec2 describe-instances --filters Name=tag-key,Values=Stack