Skip to content

Instantly share code, notes, and snippets.

@bashtoni
Created June 4, 2020 08:26
Show Gist options
  • Save bashtoni/a83e0ea00d3b3c23efb6bd1d02e83cec to your computer and use it in GitHub Desktop.
Save bashtoni/a83e0ea00d3b3c23efb6bd1d02e83cec to your computer and use it in GitHub Desktop.
Create volume with name matching snapshot name
snap=snap-123456789
desc=$(aws ec2 describe-snapshots --snapshot-ids $snap --query Snapshots[].Description --output text)
aws ec2 create-volume --snapshot-id $snap --availability-zone ap-southeast-2c --tag-specifications "[{\"ResourceType\":\"volume\",\"Tags\":[{\"Key\":\"Name\",\"Value\":\"$desc\"}]}]"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment