Tag EC2 & EBS Volumes on Creation @jeffbar – #aws cli needs #pip install not apt

Views: 2169

Creating EBS Volumes and EC2 Instances with tags from the beginning is new

Believe it or not this announcement that you can tag your ec2 or volume upon creation is new from March 2017. I am presently working with Ubuntu Xenial. When you install aws cli from the apt , it has the old version that does not support tags. took me 3 hours to figure it out. I hope it wont take you so long.

 

When you have the old version of aws you get the following error:

Unknown options: –tag-specifications, ResourceType

If you have this issue remove the old version of awscli via yum or apt, then follow the instructions that AWS give to use pip at http://docs.aws.amazon.com/cli/latest/userguide/installing.html

pip install awscli –upgrade –user

The examples given at: http://docs.aws.amazon.com/cli/latest/reference/ec2/create-volume.html actually do work

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}]’

 

From AWS – Jeff Bar’s Blog,

Today we are making tagging more flexible and more useful, with four new features: Tag on Creation – You can now specify tags for EC2 instances and EBS volumes as part of the API call that creates the resources. Enforced Tag Usage – You can now write IAM policies that mandate the use of specific tags on EC2 instances or EBS volumes. Resource-Level Permissions – By popular request, the CreateTags and DeleteTags functions now support IAM’s resource-level permissions. Enforced Volume Encryption – You can n

Source: New – Tag EC2 Instances & EBS Volumes on Creation | AWS Blog

Leave a Reply