Last active
April 3, 2016 17:58
-
-
Save revilokeb/9ea39cac9df1e1e8044c49b5aa4b0637 to your computer and use it in GitHub Desktop.
Shell script to automatically create public AMI deepdetect_revilokeb_TIMESTAMP
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
PATH_TO_PACKER/packer build -var 'aws_access_key=MY_AWS_KEY' -var 'aws_secret_key=MY_AWS_SECRET_KEY' PATH_TO_PACKER_JSON/dede.json 2>&1 | sudo tee PATH_TO_OUTPUT/output.txt | |
ami_name=`tail -2 PATH_TO_OUTPUT/output.txt | head -2 | awk 'match($0, /ami-.*/) { print substr($0, RSTART, RLENGTH) }'` | |
aws ec2 modify-image-attribute --image-id $ami_name --launch-permission "{\"Add\":[{\"Group\":\"all\"}]}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment