Skip to content
This repository was archived by the owner on Mar 29, 2023. It is now read-only.

Commit ba96696

Browse files
authored
Merge pull request #20 from gruntwork-io/ami-fix
Publish public AMIs to different AWS account
2 parents bbc7510 + 7093184 commit ba96696

File tree

2 files changed

+9
-8
lines changed

2 files changed

+9
-8
lines changed

.circleci/publish-amis.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,15 @@ if [[ -z "$PACKER_BUILD_NAME" ]]; then
2828
exit 1
2929
fi
3030

31+
if [[ -z "$AMI_PUBLISHING_ACCESS_KEY_ID" || -z "$AMI_PUBLISHING_SECRET_ACCESS_KEY" ]]; then
32+
echo "ERROR: This script expects AWS access keys for publishing public AMIs to be set as the environment variables AMI_PUBLISHING_ACCESS_KEY_ID and AMI_PUBLISHING_SECRET_ACCESS_KEY."
33+
exit 1
34+
fi
35+
36+
# Publish AMIs to a different AWS account (not our test account) to ensure they don't get deleted by cloud-nuke
37+
export AWS_ACCESS_KEY_ID="$AMI_PUBLISHING_ACCESS_KEY_ID"
38+
export AWS_SECRET_ACCESS_KEY="$AMI_PUBLISHING_SECRET_ACCESS_KEY"
39+
3140
# Build the example AMI. WARNING! In a production setting, you should build your own AMI to ensure it has exactly the
3241
# configuration you want. We build this example AMI solely to make initial use of this Module as easy as possible.
3342
build-packer-artifact \
@@ -46,11 +55,3 @@ publish-ami \
4655
--markdown-description-text "**WARNING! Do NOT use these AMIs in a production setting.** They are meant only to make
4756
initial experiments with this module more convenient."
4857

49-
# Git add, commit, and push the newly created AMI IDs as a markdown doc to the repo
50-
git-add-commit-push \
51-
--path "$AMI_LIST_MARKDOWN_DIR/$PACKER_BUILD_NAME-list.md" \
52-
--message "$GIT_COMMIT_MESSAGE" \
53-
--user-name "$GIT_USER_NAME" \
54-
--user-email "$GIT_USER_EMAIL" \
55-
--git-push-behavior "current" \
56-
--branch-name "$BRANCH_NAME"

_docs/ubuntu-ami-list.md

Whitespace-only changes.

0 commit comments

Comments
 (0)