From f649a32d4896ed43ea5fc37536e38d31bba8b259 Mon Sep 17 00:00:00 2001 From: Alex Crawford Date: Wed, 2 Nov 2016 13:50:36 -0700 Subject: [PATCH] oem/ami: make snapshots public This is needed so that users can copy the public AMIs into their own accounts. --- oem/ami/publish_ami.sh | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/oem/ami/publish_ami.sh b/oem/ami/publish_ami.sh index 261ea82ffd..dff084b4d8 100755 --- a/oem/ami/publish_ami.sh +++ b/oem/ami/publish_ami.sh @@ -86,21 +86,18 @@ publish_ami() { source $DIR/marineam-auth.sh fi - # Only required for publishing to the marketplace - if [[ "$r" == "us-east-1" ]]; then - local r_snapshotid=$(ec2-describe-images --region="$r" "$r_amiid" \ - | grep -E '^BLOCKDEVICEMAPPING.*/dev/(xv|s)da' | cut -f5) || true + local r_snapshotid=$(ec2-describe-images --region="$r" "$r_amiid" \ + | grep -E '^BLOCKDEVICEMAPPING.*/dev/(xv|s)da' | cut -f5) || true - if [[ -z "${r_snapshotid}" ]]; then - echo "$0: Cannot find snapshot id for $r_amiid in $r" >&2 - return 1 - fi - - echo "Sharing snapshot $r_snapshotid in $r with Amazon" - ec2-modify-snapshot-attribute --region "$r" \ - "$r_snapshotid" -c --add 679593333241 + if [[ -z "${r_snapshotid}" ]]; then + echo "$0: Cannot find snapshot id for $r_amiid in $r" >&2 + return 1 fi + echo "Making $r_snapshotid in $r public" + ec2-modify-snapshot-attribute --region "$r" \ + "$r_snapshotid" --create-volume-permission --add all + echo "Making $r_amiid in $r public" ec2-modify-image-attribute --region "$r" \ "$r_amiid" --launch-permission -a all