AWS CloudFormation Template
- {
- "AWSTemplateFormatVersion" : "2010-09-09",
- "Parameters" : {
- "BastionHostKeyName" : {
- "Type" : "String",
- "Description" : "The name of the private key file to use for SSH/RDP access to the bastion host."
- },
- "BastionSecurityCIDR" : {
- "Type" : "String",
- "Description" : "The CIDR range to use to lock down security on the bastion host.",
- "Default" : "0.0.0.0/0"
- },
- "BastionInstanceType" : {
- "Type" : "String",
- "Description" : "The size of the instance to use for the bastion host."
- }
- },
- "Mappings" : {
- "AmazonLinuxAMI": {
- "us-east-1": {
- "AMI": "ami-1ecae776"
- },
- "us-west-1": {
- "AMI": "ami-d114f295"
- },
- "us-west-2": {
- "AMI": "ami-e7527ed7"
- },
- "eu-west-1": {
- "AMI": "ami-a10897d6"
- },
- "eu-central-1": {
- "AMI": "ami-a8221fb5"
- },
- "sa-east-1": {
- "AMI": "ami-b52890a8"
- },
- "ap-southeast-1": {
- "AMI": "ami-68d8e93a"
- },
- "ap-southeast-2": {
- "AMI": "ami-fd9cecc7"
- },
- "ap-northeast-1": {
- "AMI": "ami-cbf90ecb"
- }
- }
- },
- "Resources" : {
- "VPC" : {
- "Type" : "AWS::EC2::VPC",
- "Properties" : {
- "CidrBlock" : "10.1.0.0/16",
- "EnableDnsSupport" : "true",
- "EnableDnsHostnames" : "true",
- "Tags" : [{
- "Key" : "Name",
- "Value" : "Lab VPC"
- }
- ]
- }
- },
- "InternetGateway" : {
- "Type" : "AWS::EC2::InternetGateway",
- "DependsOn" : "VPC"
- },
- "AttachGateway" : {
- "Type" : "AWS::EC2::VPCGatewayAttachment",
- "DependsOn" : ["VPC", "InternetGateway"],
- "Properties" : {
- "VpcId" : {
- "Ref" : "VPC"
- },
- "InternetGatewayId" : {
- "Ref" : "InternetGateway"
- }
- }
- },
- "PublicSubnet1" : {
- "Type" : "AWS::EC2::Subnet",
- "DependsOn" : "AttachGateway",
- "Properties" : {
- "VpcId" : {
- "Ref" : "VPC"
- },
- "CidrBlock" : "10.1.10.0/24",
- "MapPublicIpOnLaunch" : "true",
- "AvailabilityZone" : {
- "Fn::Select" : [
- "0", {
- "Fn::GetAZs" : ""
- }
- ]
- },
- "Tags" : [{
- "Key" : "Name",
- "Value" : "Public Subnet 1"
- }
- ]
- }
- },
- "PrivateSubnet1" : {
- "Type" : "AWS::EC2::Subnet",
- "DependsOn" : "AttachGateway",
- "Properties" : {
- "VpcId" : {
- "Ref" : "VPC"
- },
- "CidrBlock" : "10.1.50.0/24",
- "AvailabilityZone" : {
- "Fn::Select" : [
- "0", {
- "Fn::GetAZs" : ""
- }
- ]
- },
- "Tags" : [{
- "Key" : "Name",
- "Value" : "Private Subnet 1"
- }
- ]
- }
- },
- "PublicRouteTable" : {
- "Type" : "AWS::EC2::RouteTable",
- "DependsOn" : ["VPC", "AttachGateway"],
- "Properties" : {
- "VpcId" : {
- "Ref" : "VPC"
- },
- "Tags" : [{
- "Key" : "Name",
- "Value" : "Public"
- }
- ]
- }
- },
- "PublicRoute" : {
- "Type" : "AWS::EC2::Route",
- "DependsOn" : ["PublicRouteTable", "AttachGateway"],
- "Properties" : {
- "RouteTableId" : {
- "Ref" : "PublicRouteTable"
- },
- "DestinationCidrBlock" : "0.0.0.0/0",
- "GatewayId" : {
- "Ref" : "InternetGateway"
- }
- }
- },
- "PublicSubnet1RouteTableAssociation" : {
- "Type" : "AWS::EC2::SubnetRouteTableAssociation",
- "DependsOn" : ["PublicRouteTable", "PublicSubnet1", "AttachGateway"],
- "Properties" : {
- "SubnetId" : {
- "Ref" : "PublicSubnet1"
- },
- "RouteTableId" : {
- "Ref" : "PublicRouteTable"
- }
- }
- },
- "PrivateRouteTable" : {
- "Type" : "AWS::EC2::RouteTable",
- "DependsOn" : "AttachGateway",
- "Properties" : {
- "VpcId" : {
- "Ref" : "VPC"
- },
- "Tags" : [{
- "Key" : "Name",
- "Value" : "Private"
- }
- ]
- }
- },
- "PrivateSubnet1RouteTableAssociation" : {
- "Type" : "AWS::EC2::SubnetRouteTableAssociation",
- "DependsOn" : ["PublicRouteTable", "PrivateSubnet1", "AttachGateway"],
- "Properties" : {
- "SubnetId" : {
- "Ref" : "PrivateSubnet1"
- },
- "RouteTableId" : {
- "Ref" : "PrivateRouteTable"
- }
- }
- },
- "PrivateNetworkAcl" : {
- "Type" : "AWS::EC2::NetworkAcl",
- "DependsOn" : "AttachGateway",
- "Properties" : {
- "VpcId" : {
- "Ref" : "VPC"
- },
- "Tags" : [{
- "Key" : "Network",
- "Value" : "Private"
- }
- ]
- }
- },
- "NATInstance" : {
- "Type" : "AWS::EC2::Instance",
- "DependsOn" : ["AttachGateway", "PublicRoute", "PublicSubnet1"],
- "Properties" : {
- "ImageId" : {
- "Fn::FindInMap" : [
- "AmazonLinuxAMI", {
- "Ref" : "AWS::Region"
- },
- "AMI"
- ]
- },
- "InstanceType" : "t2.small",
- "NetworkInterfaces" : [{
- "DeviceIndex" : "0",
- "AssociatePublicIpAddress" : "true",
- "SubnetId" : {
- "Ref" : "PublicSubnet1"
- },
- "GroupSet" : [{
- "Ref" : "NATSecurityGroup"
- }
- ]
- }
- ],
- "SourceDestCheck" : "false",
- "Tags" : [{
- "Key" : "Name",
- "Value" : "NAT"
- }
- ],
- "UserData" : {
- "Fn::Base64" : {
- "Fn::Join" : [
- "\n",
- [
- "#!/bin/bash",
- "yum -y update",
- "echo 1 > /proc/sys/net/ipv4/ip_forward",
- "echo 0 > /proc/sys/net/ipv4/conf/eth0/send_redirects",
- "/sbin/iptables -t nat -A POSTROUTING -o eth0 -s 0.0.0.0/0 -j MASQUERADE",
- "/sbin/iptables-save > /etc/sysconfig/iptables",
- "mkdir -p /etc/sysctl.d/",
- "cat <<EOF > /etc/sysctl.d/nat.conf",
- "net.ipv4.ip_forward = 1",
- "net.ipv4.conf.eth0.send_redirects = 0",
- "EOF \n"
- ]
- ]
- }
- }
- }
- },
- "NATSecurityGroup" : {
- "Type" : "AWS::EC2::SecurityGroup",
- "DependsOn" : "AttachGateway",
- "Properties" : {
- "GroupDescription" : "Enable internal access to the NAT device",
- "VpcId" : {
- "Ref" : "VPC"
- },
- "SecurityGroupIngress" : [{
- "IpProtocol" : "tcp",
- "FromPort" : "0",
- "ToPort" : "1024",
- "CidrIp" : "10.1.50.0/24"
- }, {
- "IpProtocol" : "udp",
- "FromPort" : "0",
- "ToPort" : "1024",
- "CidrIp" : "10.1.50.0/24"
- }
- ],
- "SecurityGroupEgress" : [{
- "IpProtocol" : "tcp",
- "FromPort" : "0",
- "ToPort" : "65535",
- "CidrIp" : "0.0.0.0/0"
- }, {
- "IpProtocol" : "udp",
- "FromPort" : "0",
- "ToPort" : "65535",
- "CidrIp" : "0.0.0.0/0"
- }
- ]
- }
- },
- "PrivateRoute" : {
- "Type" : "AWS::EC2::Route",
- "DependsOn" : ["NATInstance", "PrivateRouteTable"],
- "Properties" : {
- "RouteTableId" : {
- "Ref" : "PrivateRouteTable"
- },
- "DestinationCidrBlock" : "0.0.0.0/0",
- "InstanceId" : {
- "Ref" : "NATInstance"
- }
- }
- },
- "BastionServerSecurityGroup" : {
- "Type" : "AWS::EC2::SecurityGroup",
- "DependsOn" : "AttachGateway",
- "Properties" : {
- "GroupDescription" : "Security Group for bastion server",
- "VpcId" : {
- "Ref" : "VPC"
- },
- "Tags" : [{
- "Key" : "Name",
- "Value" : "BastionServerSecurityGroup"
- }, {
- "Key" : "ResourceGroup",
- "Value" : "CloudFormationResource"
- }
- ],
- "SecurityGroupIngress" : [{
- "IpProtocol" : "tcp",
- "FromPort" : "22",
- "ToPort" : "22",
- "CidrIp" : {
- "Ref" : "BastionSecurityCIDR"
- }
- }
- ]
- }
- },
- "BastionServer" : {
- "Type" : "AWS::EC2::Instance",
- "DependsOn" : ["NATInstance"],
- "Properties" : {
- "ImageId" : {
- "Fn::FindInMap" : [
- "AmazonLinuxAMI", {
- "Ref" : "AWS::Region"
- },
- "AMI"
- ]
- },
- "InstanceType" : {
- "Ref" : "BastionInstanceType"
- },
- "KeyName" : {
- "Ref" : "BastionHostKeyName"
- },
- "NetworkInterfaces" : [{
- "DeviceIndex" : "0",
- "AssociatePublicIpAddress" : "true",
- "SubnetId" : {
- "Ref" : "PrivateSubnet1"
- },
- "GroupSet" : [{
- "Ref" : "BastionServerSecurityGroup"
- }
- ]
- }
- ],
- "Tags" : [{
- "Key" : "Name",
- "Value" : "BastionServer"
- }
- ],
- "UserData" : {
- "Fn::Base64" : {
- "Fn::Join" : [
- "",
- [
- "#!/bin/bash -ex \n",
- "yum -y update \n"
- ]
- ]
- }
- }
- }
- }
- }
- }
AWS CloudFormation Template的更多相关文章
- Lab_7_Automating_v2.5
System Operations - Lab 7: Automating Deployments with CloudFormation - 2.5 ======================== ...
- 【译】OpenStack Heat基础介绍
原文:http://blog.scottlowe.org/2014/05/01/an-introduction-to-openstack-heat/ 本文将简要地介绍OpenStack Heat. H ...
- OpenStack 初探(一) -- All-In-One模式部署(初学OpenStack必备)
OpenStack 初探(一) -- All-In-One模式部署(初学OpenStack必备) 一.操作前需了解: 1. OpenStack提供IaaS(基础设施即服务)服务,它是开源的云计 ...
- System Operations on AWS - Lab 7 - CloudFormation
CloudFormation模板:创建一个VPC(包含Public子网,Private子网,分别在不同的AZ),创建NAT,Bastion Server在Public子网. 1. 修改并运行AWS C ...
- DevOps on AWS之Cloudformation实践篇
cloudformation入门实践 AWS cloudformation通过模板对AWS云资源进行编排和调用.并且可以通过模板代码层面的修改就可以对现有环境进行升级改造,云端业务的灵活便捷特点展现无 ...
- DevOps on AWS之Cloudformation概念介绍篇
Cloudformation的相关概念 AWS cloudformation是一项典型的(IAC)基础架构即代码服务..通过编写模板对亚马逊云服务的资源进行调用和编排.借助cloudformation ...
- 亚马逊云服务之CloudFormation
亚马逊的Web Service其实包含了一套云服务.云服务主要分为三种: IaaS: Infrastructure as a service,基础设施即服务. PaaS: Platform as a ...
- CloudFormation
亚马逊云服务之CloudFormation 亚马逊的Web Service其实包含了一套云服务.云服务主要分为三种: IaaS: Infrastructure as a service,基础设施即 ...
- OpenStack-Heat中的AWS::WaitCondition的使用
在heat中.一个instance的创建成功信号是在这个instance状态成为active之后发出的,这时候user-data可能还没有运行.可是heat已经觉得这个resource创建成功了,開始 ...
随机推荐
- 深入理解JavaScript系列:JavaScript的构成
此篇文章不是干货类型,也算不上概念阐述,就是简单的进行一个思路上的整理. 要了解一样东西或者完成一件事情,首要的就是先要搞清楚他是什么.作为一个前端开发人员,JavaScript应该算作是最核心之一的 ...
- HDU 4336 容斥原理 || 状压DP
状压DP :F(S)=Sum*F(S)+p(x1)*F(S^(1<<x1))+p(x2)*F(S^(1<<x2))...+1; F(S)表示取状态为S的牌的期望次数,Sum表示 ...
- HDU5402 暴力模拟
因为题目中没有说是否是正整数,导致我们以为是DP,没敢做...太可惜了,不过现场赛绝对不会出现这种情况,毕竟所有的提问是都可以看见的. 题意:告诉一个矩阵,然后求从(1,1)到(n,m)能走过的最大和 ...
- 修改SharePoint 2013中item Created by 信息
因为公司的系统有点小bug.额,要做点坏事,把系统没记上的东西偷偷补上去,但是item的created by变成了我(这怎么行,不能让别人知道我做了坏事,一定是隔壁小李干的! 懒得开visual st ...
- /date(-62135596800000)转换正常格式的时间
function formatDatebox(value) { if (value == null || value == '') { return ''; } var dt = parseToDat ...
- iredmail安装脚本分析(一)---iRedmail.sh
iredmail是一套以postfix为核心的整合邮件系统的安装脚本,可以达到快速部署邮件服务器的目的.为了让自己不遗忘shell的语法,所以闲来无事,学习一下他的代码. 我从官网下载他的最新版,解压 ...
- Objective-C 代码块(block)的使用
代码块本质上是和其他变量类似.不同的是,代码块存储的数据是一个函数体.使用代码块是,你可以像调用其他标准函数一样,传入参数数,并得到返回值. 脱字符(^)是块的语法标记.按照我们熟悉的参数语法规约所定 ...
- 【转载】Spark性能优化指南——高级篇
前言 数据倾斜调优 调优概述 数据倾斜发生时的现象 数据倾斜发生的原理 如何定位导致数据倾斜的代码 查看导致数据倾斜的key的数据分布情况 数据倾斜的解决方案 解决方案一:使用Hive ETL预处理数 ...
- 二叉树[C实现]
#include<stdio.h> #include<malloc.h> #include<iostream> //定义节点 typedef struct BiNo ...
- ThinkPHP 3.2 获取页面运行时间
在ThinkPHP中,可以通过在config.php中配置'SHOW_PAGE_TRACE' =>true,打开页面调试,实现页面载入时间的显示.但显示在页面右下角TP的LOGO显然不能适用于我 ...