Skip to content
Permalink
master
Go to file
 
 
Cannot retrieve contributors at this time
executable file 26 lines (15 sloc) 1.05 KB
#!/bin/bash
aws_acct_id="823003027569"
aws_acct_id_plus="886593122405"
bucket="internet2-tier-appliance-us-west-1"
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 $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 $(md5sum 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 all accounts"
ami_image_description=$(aws ec2 describe-images --image-ids $ami_id --query 'Images[0].{Description:Tags[0].Value}')
echo $ami_image_description
aws ec2 modify-image-attribute --image-id $ami_id --launch-permission "{\"Add\":[{\"UserId\":\"$aws_acct_id\"}]}"
aws ec2 modify-image-attribute --image-id $ami_id --launch-permission "{\"Add\":[{\"UserId\":\"$aws_acct_id_plus\"}]}"
You can’t perform that action at this time.