Skip to content
Permalink
4ff5742260
Switch branches/tags

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?
Go to file
 
 
Cannot retrieve contributors at this time
executable file 26 lines (16 sloc) 1.13 KB
#!/bin/bash
aws_acct_id="823003027569"
bucket="internet2-tier-appliance-us-west-1"
vagrant_key=$(aws s3api list-objects-v2 --bucket $bucket --query 'reverse(sort_by(Contents[?contains(Key, `vagrant`)], &LastModified))[0].[Key]' --output text | tr -d '\n' )
ova_key=$(aws s3api list-objects-v2 --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\"}]}"