From 08c6ab21357e1c9d585ddcba2e2b61bd206d4afc Mon Sep 17 00:00:00 2001
From: "S. X. Liang" <60531983+Scottpedia@users.noreply.github.com>
Date: Sat, 7 Nov 2020 15:41:22 -0500
Subject: [PATCH] Update cloudformation-template-ipsec (#850)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* 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.
* Update README.md
- Remove the notice no longer needed. (The stack will be flagged as CREATE_COMPLETE only when the script succeeds on the VM.)
* Update README-zh.md
- 移除没用的贴士。堆栈将会自动检查脚本是否成功执行。
---
aws/README-zh.md | 4 +---
aws/README.md | 4 +---
aws/cloudformation-template-ipsec | 20 +++++++++++++++++++-
3 files changed, 21 insertions(+), 7 deletions(-)
diff --git a/aws/README-zh.md b/aws/README-zh.md
index 6e8e7bd..cacac0b 100644
--- a/aws/README-zh.md
+++ b/aws/README-zh.md
@@ -31,9 +31,7 @@
-要指定一个 AWS 区域,你可以使用导航栏上你的帐户信息右侧的选择器。成功创建堆栈后,单击 **Outputs** 选项卡以查看你的 VPN 登录信息。然后继续下一步:[配置 VPN 客户端](../README-zh.md#下一步)。
-
-> **注:** 在堆栈显示 **CREATE_COMPLETE** 之后,你至少需要再等待5分钟,然后使用 VPN 客户端连接。这是为了确保 VPN 安装完成。
+要指定一个 AWS 区域,你可以使用导航栏上你的帐户信息右侧的选择器。一但堆栈的部署状态变成 **"CREATE_COMPLETE"** ,你就可以连接到服务器了。单击 **Outputs** 选项卡以查看你的 VPN 登录信息,然后继续下一步:[配置 VPN 客户端](../README-zh.md#下一步)。
## 常见问题
diff --git a/aws/README.md b/aws/README.md
index eb6cb35..9bd7293 100644
--- a/aws/README.md
+++ b/aws/README.md
@@ -31,9 +31,7 @@ Click the icon below to start:
-You may choose an AWS region using the selector to the right of your account information on the navigation bar. After the stack is successfully created, click the **Outputs** tab to view your VPN login details. Then continue to [Next steps: Configure VPN Clients](../README.md#next-steps).
-
-> **Note:** You will need to wait at least 5 minutes after the stack shows **CREATE_COMPLETE**, before you can connect to the server with a VPN client. This is to allow time for the VPN setup to complete.
+You may choose an AWS region using the selector to the right of your account information on the navigation bar. As soon as the stack's status turns **"CREATE_COMPLETE"**, you are ready to connect to the VPN server. Click the **Outputs** tab to view your VPN login details. Then continue to [Next steps: Configure VPN Clients](../README.md#next-steps).
## FAQs
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"
]
]
}