Skip to content

Instantly share code, notes, and snippets.

@shamasis
Created December 21, 2014 09:41
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shamasis/6134c16d3ae0a914610f to your computer and use it in GitHub Desktop.
Save shamasis/6134c16d3ae0a914610f to your computer and use it in GitHub Desktop.
Create and allocate AWS Elastic IP at one go using AWS CLI. Replace `$1` with your Instance Id or simply execute this file as a script and pass the Instance Id as the first argument to the script.
aws ec2 associate-address --instance-id $1 --public-ip $(aws ec2 allocate-address --output text --query 'PublicIp')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment