Skip to content

Instantly share code, notes, and snippets.

@hayd
Last active August 11, 2021 17:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hayd/cb6da4bdbf2e19531b46b8ef76c326d8 to your computer and use it in GitHub Desktop.
Save hayd/cb6da4bdbf2e19531b46b8ef76c326d8 to your computer and use it in GitHub Desktop.
Tag Volumes in Elastic Beanstalk
container_commands:
tagVolume:
command: aws ec2 create-tags --resources $(aws ec2 describe-instances --region $(curl http://169.254.169.254/latest/meta-data/placement/availability-zone| sed 's/[a-z]$//') --instance-id $(curl http://169.254.169.254/latest/meta-data/instance-id ) --output text --query Reservations[0].Instances[0].BlockDeviceMappings[0].Ebs.VolumeId) --region $(curl http://169.254.169.254/latest/meta-data/placement/availability-zone| sed 's/[a-z]$//') --tags Key=Name,Value=$(/opt/elasticbeanstalk/bin/get-config container -k environment_name)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment