From 8bd7c3b02264faa284c33cc3567058bdad748148 Mon Sep 17 00:00:00 2001 From: "S. X. Liang" <60531983+Scottpedia@users.noreply.github.com> Date: Sun, 13 Sep 2020 17:09:50 -0400 Subject: [PATCH] Update cloudformation-template-ipsec - Add "CreationPolicy" to notify the user when the setup script succeeds on the virtual machine. The stack fails if the script fails. - The timeout is 10 minutes. - This feature is to be tested on Debian(s). I have personally tested it on Ubuntu20. --- aws/cloudformation-template-ipsec | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/aws/cloudformation-template-ipsec b/aws/cloudformation-template-ipsec index 8ad03a4..1a488d0 100644 --- a/aws/cloudformation-template-ipsec +++ b/aws/cloudformation-template-ipsec @@ -320,6 +320,11 @@ }, "VpnInstance": { "Type": "AWS::EC2::Instance", + "CreationPolicy": { + "ResourceSignal": { + "Timeout": "PT10M" + } + }, "Properties": { "UserData": { "Fn::Base64": { @@ -343,7 +348,20 @@ }, "'\n", "sleep 60\n", - "wget https://git.io/vpnsetup -O vpnsetup.sh && sh vpnsetup.sh\n" + "wget https://git.io/vpnsetup -O vpnsetup.sh && sh vpnsetup.sh\n", + "apt-get install python3-pip -y\n", + "pip3 install https://s3.amazonaws.com/cloudformation-examples/aws-cfn-bootstrap-py3-latest.tar.gz\n", + "cfn-signal ", + "--stack ", + { + "Ref": "AWS::StackName" + }, + " --resource VpnInstance ", + " --region ", + { + "Ref": "AWS::Region" + }, + "\n" ] ] }