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

Commit fcefdd2

Browse files
committed
terminate instances if not provisioned correctly
1 parent 5397c0c commit fcefdd2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/templates/gwfcore/gwfcore-launch-template.template.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ Resources:
5858
- !Ref Namespace
5959

6060
LaunchTemplateData:
61+
# Used in tandem with UserData to check if the instance is provisioned
62+
# correctly. It is important to terminate mis-provisioned instances before
63+
# jobs are placed on them
64+
InstanceInitiatedShutdownBehavior: terminate
6165
TagSpecifications:
6266
- ResourceType: instance
6367
Tags:
@@ -103,6 +107,10 @@ Resources:
103107
- curl -s "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "/tmp/awscliv2.zip"
104108
- unzip -q /tmp/awscliv2.zip -d /tmp
105109
- /tmp/aws/install -b /usr/bin
110+
111+
# check that the aws-cli was actually installed. if not shutdown (terminate) the instance
112+
- command -v aws || shutdown -P now
113+
106114
- mkdir -p /opt/aws-cli/bin
107115
- cp -a $(dirname $(find /usr/local/aws-cli -name 'aws' -type f))/. /opt/aws-cli/bin/
108116

0 commit comments

Comments
 (0)