diff --git a/nixos/maintainers/scripts/ec2/create-s3-amis.sh b/nixos/maintainers/scripts/ec2/create-s3-amis.sh index 140b4fcbddb8..ed861a3944ac 100755 --- a/nixos/maintainers/scripts/ec2/create-s3-amis.sh +++ b/nixos/maintainers/scripts/ec2/create-s3-amis.sh @@ -31,17 +31,22 @@ buildAndUploadFor() { -a "$EC2_ACCESS_KEY" -s "$EC2_SECRET_KEY" --location "$s3location" \ --url http://s3.amazonaws.com - kernel=$(ec2-describe-images -o amazon --filter "manifest-location=*pv-grub-hd0_1.03-$arch*" --region "$region" | cut -f 2) + kernel=$(ec2-describe-images -o amazon --filter "manifest-location=*pv-grub-hd0_1.04-$arch*" --region "$region" | cut -f 2) echo "using PV-GRUB kernel $kernel" - ami=$(ec2-register "$bucket/nixos.img.manifest.xml" -n "$name" -d "NixOS $system r$revision" \ + ami=$(ec2-register "$bucket/nixos.img.manifest.xml" -n "$name" -d "NixOS $system r$revision" -O "$EC2_ACCESS_KEY" -W "$EC2_SECRET_KEY" \ --region "$region" --kernel "$kernel" | cut -f 2) echo "AMI ID is $ami" - echo $ami >> $region.s3.ami-id + echo " \"14.12\".\"$region\".s3 = \"$ami\";" >> ec2-amis.nix - ec2-modify-image-attribute --region "$region" "$ami" -l -a all + ec2-modify-image-attribute --region "$region" "$ami" -l -a all -O "$EC2_ACCESS_KEY" -W "$EC2_SECRET_KEY" + + for cp_region in us-east-1 us-west-1 us-west-2 eu-central-1 ap-southeast-1 ap-southeast-2 ap-northeast-1 sa-east-1; do + new_ami=$(aws ec2 copy-image --source-image-id $ami --source-region $region --region $cp_region --name "$name" | json ImageId) + echo " \"14.12\".\"$cp_region\".s3 = \"$new_ami\";" >> ec2-amis.nix + done done }