diff --git a/aws/README-zh.md b/aws/README-zh.md index c6e9e53..0e811d1 100644 --- a/aws/README-zh.md +++ b/aws/README-zh.md @@ -1,9 +1,7 @@ -# 使用 CloudFormation 在 Amazon EC2 上部署(测试版) +# 使用 CloudFormation 在 Amazon EC2 上部署 *其他语言版本: [English](README.md), [简体中文](README-zh.md).* -> **注:** 此部署模板目前为 **测试版**,在使用时你可能会遇到错误。如果遇到问题,请创建一个新的 Issue。 - 使用这个模板,你可以在 Amazon Elastic Compute Cloud(Amazon EC2)上快速搭建一个 IPsec VPN 服务器。在继续之前,请参见 EC2 [定价细节](https://aws.amazon.com/cn/ec2/pricing/on-demand/)。在部署中使用 `t2.micro` 服务器实例可能符合 [AWS 免费套餐](https://aws.amazon.com/cn/free/) 的资格。 可用的自定义参数: @@ -20,7 +18,7 @@ 确保使用 **AWS 账户根用户** 或者有 **管理员权限** 的 **IAM 用户** 部署此模板。 -右键单击这个 [**模板链接**](https://raw.githubusercontent.com/hwdsl2/setup-ipsec-vpn/master/aws/cloudformation-template-ipsec),并将它保存到你的计算机上的一个新文件。然后在 ["创建堆栈" 向导](https://console.aws.amazon.com/cloudformation/home#/stacks/new)中将其作为模板源上传。 +右键单击这个 [**模板链接**](https://raw.githubusercontent.com/hwdsl2/setup-ipsec-vpn/master/aws/cloudformation-template-ipsec.json),并将它保存到你的计算机上的一个新文件。然后在 ["创建堆栈" 向导](https://console.aws.amazon.com/cloudformation/home#/stacks/new)中将其作为模板源上传。 ![上传模板](upload-the-template.png) diff --git a/aws/README.md b/aws/README.md index b7d51db..3708d3c 100644 --- a/aws/README.md +++ b/aws/README.md @@ -1,9 +1,7 @@ -# Deploy to Amazon EC2 using CloudFormation (Beta) +# Deploy to Amazon EC2 using CloudFormation *Read this in other languages: [English](README.md), [简体中文](README-zh.md).* -> **Note:** This deployment template is still in **BETA**. You may encounter failures during deployment. In that case, please open a new issue. - This template will create a fully-working IPsec VPN server on Amazon Elastic Compute Cloud (Amazon EC2). Please make sure to check the EC2 [pricing details](https://aws.amazon.com/ec2/pricing/on-demand/) before continuing. Using a `t2.micro` server instance for your deployment may qualify for the [AWS Free Tier](https://aws.amazon.com/free/). Available customization parameters: @@ -20,7 +18,7 @@ Available customization parameters: Make sure to deploy this template with an **AWS Account Root User** or an **IAM Account** with **Administrator Access**. -Right-click this [**template link**](https://raw.githubusercontent.com/hwdsl2/setup-ipsec-vpn/master/aws/cloudformation-template-ipsec) and save as a file on your computer. Then upload it as the template source in the [stack creation wizard](https://console.aws.amazon.com/cloudformation/home#/stacks/new). +Right-click this [**template link**](https://raw.githubusercontent.com/hwdsl2/setup-ipsec-vpn/master/aws/cloudformation-template-ipsec.json) and save as a file on your computer. Then upload it as the template source in the [stack creation wizard](https://console.aws.amazon.com/cloudformation/home#/stacks/new). ![Upload the template](upload-the-template.png) diff --git a/aws/cloudformation-template-ipsec b/aws/cloudformation-template-ipsec.json similarity index 96% rename from aws/cloudformation-template-ipsec rename to aws/cloudformation-template-ipsec.json index 5c1284e..1332983 100644 --- a/aws/cloudformation-template-ipsec +++ b/aws/cloudformation-template-ipsec.json @@ -651,21 +651,15 @@ " regionName = event['ResourceProperties']['Region']", " distribution = event['ResourceProperties']['Distribution']", " ec2 = boto3.client('ec2',regionName)", - " AMIName = ''", - " if distribution == 'Ubuntu1604':", - " AMIName = 'ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*'", - " elif distribution == 'Ubuntu1804':", - " AMIName = 'ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*'", - " elif distribution == 'Ubuntu2004':", - " AMIName = 'ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*'", - " elif distribution == 'Debian9':", - " AMIName = 'debian-stretch-hvm-x86_64-gp2-*'", - " elif distribution == 'CentOS7':", - " AMIName = 'CentOS 7.9.2009 x86_64'", - " elif distribution == 'CentOS8':", - " AMIName = 'CentOS 8.3.2011 x86_64'", - " elif distribution == 'AmazonLinux2':", - " AMIName = 'amzn2-ami-hvm-*.*-x86_64-gp2'", + " AMIName = {", + " 'Ubuntu1604': 'ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*',", + " 'Ubuntu1804': 'ubuntu/images/hvm-ssd/ubuntu-bionic-18.04-amd64-server-*',", + " 'Ubuntu2004': 'ubuntu/images/hvm-ssd/ubuntu-focal-20.04-amd64-server-*',", + " 'Debian9': 'debian-stretch-hvm-x86_64-gp2-*',", + " 'CentOS7': 'CentOS 7.9.2009 x86_64',", + " 'CentOS8': 'CentOS 8.3.2011 x86_64',", + " 'AmazonLinux2': 'amzn2-ami-hvm-*.*-x86_64-gp2',", + " }[distribution]", " response = ec2.describe_images(Filters=[{'Name':'name', 'Values':[AMIName]}], Owners=['099720109477', '379101102735', '125523088429', 'amazon'])", " images = response['Images']", " images.sort(key=creation_date,reverse=True)",