Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
packer-centos-7/bin/perms.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
26 lines (16 sloc)
1.13 KB
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 | |
aws_acct_id="823003027569" | |
bucket="internet2-tier-appliance-us-west-1" | |
vagrant_key=$(aws s3api list-objects --bucket $bucket --query 'reverse(sort_by(Contents[?contains(Key, `vagrant`)], &LastModified))[0].[Key]' --output text | tr -d '\n' ) | |
ova_key=$(aws s3api list-objects --bucket $bucket --query 'reverse(sort_by(Contents[?contains(Key, `ova`)], &LastModified))[0].[Key]' --output text | tr -d '\n' ) | |
echo "Found $vagrant_key" | |
aws s3api put-object-acl --bucket $bucket --key $vagrant_key --acl public-read | |
echo "(https://s3-us-west-1.amazonaws.com/$bucket/$vagrant_key)" | |
echo $(md5 builds/$vagrant_key) | |
echo "Found $ova_key" | |
aws s3api put-object-acl --bucket $bucket --key $ova_key --acl public-read | |
echo "(https://s3-us-west-1.amazonaws.com/$bucket/$ova_key)" | |
echo $(md5 builds/$ova_key) | |
ami_id=$(aws ec2 describe-images --owners $aws_acct_id --query 'reverse(sort_by(Images[?starts_with(Name, `import-ami`)], &CreationDate))[0].[ImageId]' --output text | tr -d '\n' ) | |
echo "Publishing $ami_id to $aws_acct_id" | |
aws ec2 modify-image-attribute --image-id $ami_id --launch-permission "{\"Add\":[{\"UserId\":\"$aws_acct_id\"}]}" | |