Skip to content
Permalink
Newer
Older
100755 17 lines (12 sloc) 947 Bytes
1
#!/bin/bash
2
3
aws_acct_id="823003027569"
4
bucket="internet2-tier-appliance-us-west-1"
5
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' )
6
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' )
7
8
echo "Found $vagrant_key"
9
aws s3api put-object-acl --bucket $bucket --key $vagrant_key --acl public-read
10
11
echo "Found $ova_key"
12
aws s3api put-object-acl --bucket $bucket --key $ova_key --acl public-read
13
14
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' )
15
echo "Found $ami_id"
16
17
aws ec2 modify-image-attribute --image-id $ami_id --launch-permission "{\"Add\":[{\"UserId\":\"$aws_acct_id\"}]}"
You can’t perform that action at this time.