create-amis.sh: Change directory for AMIs

(cherry picked from commit b240822cfaa80145491b7fcfe6421d7a10f6de94)
release-18.03-flake
Eelco Dolstra 2018-07-24 21:17:17 +02:00
parent 1caae7247b
commit dba78f04c2
1 changed files with 2 additions and 1 deletions

View File

@ -10,7 +10,7 @@ version=$(nix-instantiate --eval --strict '<nixpkgs>' -A lib.nixpkgsVersion | se
major=${version:0:5}
echo "NixOS version is $version ($major)"
stateDir=/var/tmp/ec2-image-$version
stateDir=/home/deploy/amis/ec2-image-$version
echo "keeping state in $stateDir"
mkdir -p $stateDir
@ -161,6 +161,7 @@ for type in $types; do
# Create a snapshot.
if [ -z "$snapId" ]; then
echo "creating snapshot..."
# FIXME: this can fail with InvalidVolume.NotFound. Eventual consistency yay.
snapId=$(aws ec2 create-snapshot --volume-id "$volId" --region "$region" --description "$description" | jq -r .SnapshotId)
if [ "$snapId" = null ]; then exit 1; fi
echo -n "$snapId" > $stateDir/$region.$type.snap-id