Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
0527e88d46
541 changed files with 75504 additions and 51429 deletions
|
|
@ -1,9 +1,3 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
template = {
|
||||
"Resources": {
|
||||
"EC2EIP": {
|
||||
"Type": "AWS::EC2::EIP"
|
||||
}
|
||||
}
|
||||
}
|
||||
template = {"Resources": {"EC2EIP": {"Type": "AWS::EC2::EIP"}}}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,11 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
template = {
|
||||
"Resources": {
|
||||
"EC2EIP": {
|
||||
"Type": "AWS::EC2::EIP"
|
||||
}
|
||||
},
|
||||
"Resources": {"EC2EIP": {"Type": "AWS::EC2::EIP"}},
|
||||
"Outputs": {
|
||||
"EIP": {
|
||||
"Description": "EIP for joining",
|
||||
"Value": {
|
||||
"Fn::Join": [
|
||||
":",
|
||||
[
|
||||
"test eip",
|
||||
{"Ref": "EC2EIP"}
|
||||
]
|
||||
]
|
||||
}
|
||||
"Value": {"Fn::Join": [":", ["test eip", {"Ref": "EC2EIP"}]]},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,38 +2,45 @@ from __future__ import unicode_literals
|
|||
|
||||
template = {
|
||||
"AWSTemplateFormatVersion": "2010-09-09",
|
||||
|
||||
"Description": "AWS CloudFormation Sample Template to create a KMS Key. The Fn::GetAtt is used to retrieve the ARN",
|
||||
|
||||
"Resources" : {
|
||||
"myKey" : {
|
||||
"Type" : "AWS::KMS::Key",
|
||||
"Properties" : {
|
||||
"Resources": {
|
||||
"myKey": {
|
||||
"Type": "AWS::KMS::Key",
|
||||
"Properties": {
|
||||
"Description": "Sample KmsKey",
|
||||
"EnableKeyRotation": False,
|
||||
"Enabled": True,
|
||||
"KeyPolicy" : {
|
||||
"KeyPolicy": {
|
||||
"Version": "2012-10-17",
|
||||
"Id": "key-default-1",
|
||||
"Statement": [
|
||||
{
|
||||
"Sid": "Enable IAM User Permissions",
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"AWS": { "Fn::Join" : ["" , ["arn:aws:iam::", {"Ref" : "AWS::AccountId"} ,":root" ]] }
|
||||
},
|
||||
"Action": "kms:*",
|
||||
"Resource": "*"
|
||||
"Sid": "Enable IAM User Permissions",
|
||||
"Effect": "Allow",
|
||||
"Principal": {
|
||||
"AWS": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
"arn:aws:iam::",
|
||||
{"Ref": "AWS::AccountId"},
|
||||
":root",
|
||||
],
|
||||
]
|
||||
}
|
||||
},
|
||||
"Action": "kms:*",
|
||||
"Resource": "*",
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
}
|
||||
},
|
||||
"Outputs" : {
|
||||
"KeyArn" : {
|
||||
"Outputs": {
|
||||
"KeyArn": {
|
||||
"Description": "Generated Key Arn",
|
||||
"Value" : { "Fn::GetAtt" : [ "myKey", "Arn" ] }
|
||||
"Value": {"Fn::GetAtt": ["myKey", "Arn"]},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ from __future__ import unicode_literals
|
|||
|
||||
template = {
|
||||
"AWSTemplateFormatVersion": "2010-09-09",
|
||||
|
||||
"Description": "AWS CloudFormation Sample Template RDS_MySQL_With_Read_Replica: Sample template showing how to create a highly-available, RDS DBInstance with a read replica. **WARNING** This template creates an Amazon Relational Database Service database instance and Amazon CloudWatch alarms. You will be billed for the AWS resources used if you create a stack from this template.",
|
||||
|
||||
"Parameters": {
|
||||
"DBName": {
|
||||
"Default": "MyDatabase",
|
||||
|
|
@ -13,13 +11,9 @@ template = {
|
|||
"MinLength": "1",
|
||||
"MaxLength": "64",
|
||||
"AllowedPattern": "[a-zA-Z][a-zA-Z0-9]*",
|
||||
"ConstraintDescription": "must begin with a letter and contain only alphanumeric characters."
|
||||
"ConstraintDescription": "must begin with a letter and contain only alphanumeric characters.",
|
||||
},
|
||||
|
||||
"DBInstanceIdentifier": {
|
||||
"Type": "String"
|
||||
},
|
||||
|
||||
"DBInstanceIdentifier": {"Type": "String"},
|
||||
"DBUser": {
|
||||
"NoEcho": "true",
|
||||
"Description": "The database admin account username",
|
||||
|
|
@ -27,9 +21,8 @@ template = {
|
|||
"MinLength": "1",
|
||||
"MaxLength": "16",
|
||||
"AllowedPattern": "[a-zA-Z][a-zA-Z0-9]*",
|
||||
"ConstraintDescription": "must begin with a letter and contain only alphanumeric characters."
|
||||
"ConstraintDescription": "must begin with a letter and contain only alphanumeric characters.",
|
||||
},
|
||||
|
||||
"DBPassword": {
|
||||
"NoEcho": "true",
|
||||
"Description": "The database admin account password",
|
||||
|
|
@ -37,112 +30,121 @@ template = {
|
|||
"MinLength": "1",
|
||||
"MaxLength": "41",
|
||||
"AllowedPattern": "[a-zA-Z0-9]+",
|
||||
"ConstraintDescription": "must contain only alphanumeric characters."
|
||||
"ConstraintDescription": "must contain only alphanumeric characters.",
|
||||
},
|
||||
|
||||
"DBAllocatedStorage": {
|
||||
"Default": "5",
|
||||
"Description": "The size of the database (Gb)",
|
||||
"Type": "Number",
|
||||
"MinValue": "5",
|
||||
"MaxValue": "1024",
|
||||
"ConstraintDescription": "must be between 5 and 1024Gb."
|
||||
"ConstraintDescription": "must be between 5 and 1024Gb.",
|
||||
},
|
||||
|
||||
"DBInstanceClass": {
|
||||
"Description": "The database instance type",
|
||||
"Type": "String",
|
||||
"Default": "db.m1.small",
|
||||
"AllowedValues": ["db.t1.micro", "db.m1.small", "db.m1.medium", "db.m1.large", "db.m1.xlarge", "db.m2.xlarge", "db.m2.2xlarge", "db.m2.4xlarge", "db.m3.medium", "db.m3.large", "db.m3.xlarge", "db.m3.2xlarge", "db.r3.large", "db.r3.xlarge", "db.r3.2xlarge", "db.r3.4xlarge", "db.r3.8xlarge", "db.m2.xlarge", "db.m2.2xlarge", "db.m2.4xlarge", "db.cr1.8xlarge"],
|
||||
"ConstraintDescription": "must select a valid database instance type."
|
||||
"AllowedValues": [
|
||||
"db.t1.micro",
|
||||
"db.m1.small",
|
||||
"db.m1.medium",
|
||||
"db.m1.large",
|
||||
"db.m1.xlarge",
|
||||
"db.m2.xlarge",
|
||||
"db.m2.2xlarge",
|
||||
"db.m2.4xlarge",
|
||||
"db.m3.medium",
|
||||
"db.m3.large",
|
||||
"db.m3.xlarge",
|
||||
"db.m3.2xlarge",
|
||||
"db.r3.large",
|
||||
"db.r3.xlarge",
|
||||
"db.r3.2xlarge",
|
||||
"db.r3.4xlarge",
|
||||
"db.r3.8xlarge",
|
||||
"db.m2.xlarge",
|
||||
"db.m2.2xlarge",
|
||||
"db.m2.4xlarge",
|
||||
"db.cr1.8xlarge",
|
||||
],
|
||||
"ConstraintDescription": "must select a valid database instance type.",
|
||||
},
|
||||
|
||||
"EC2SecurityGroup": {
|
||||
"Description": "The EC2 security group that contains instances that need access to the database",
|
||||
"Default": "default",
|
||||
"Type": "String",
|
||||
"AllowedPattern": "[a-zA-Z0-9\\-]+",
|
||||
"ConstraintDescription": "must be a valid security group name."
|
||||
"ConstraintDescription": "must be a valid security group name.",
|
||||
},
|
||||
|
||||
"MultiAZ": {
|
||||
"Description": "Multi-AZ master database",
|
||||
"Type": "String",
|
||||
"Default": "false",
|
||||
"AllowedValues": ["true", "false"],
|
||||
"ConstraintDescription": "must be true or false."
|
||||
}
|
||||
"ConstraintDescription": "must be true or false.",
|
||||
},
|
||||
},
|
||||
|
||||
"Conditions": {
|
||||
"Is-EC2-VPC": {"Fn::Or": [{"Fn::Equals": [{"Ref": "AWS::Region"}, "eu-central-1"]},
|
||||
{"Fn::Equals": [{"Ref": "AWS::Region"}, "cn-north-1"]}]},
|
||||
"Is-EC2-Classic": {"Fn::Not": [{"Condition": "Is-EC2-VPC"}]}
|
||||
"Is-EC2-VPC": {
|
||||
"Fn::Or": [
|
||||
{"Fn::Equals": [{"Ref": "AWS::Region"}, "eu-central-1"]},
|
||||
{"Fn::Equals": [{"Ref": "AWS::Region"}, "cn-north-1"]},
|
||||
]
|
||||
},
|
||||
"Is-EC2-Classic": {"Fn::Not": [{"Condition": "Is-EC2-VPC"}]},
|
||||
},
|
||||
|
||||
"Resources": {
|
||||
"DBParameterGroup": {
|
||||
"Type": "AWS::RDS::DBParameterGroup",
|
||||
"Properties": {
|
||||
"Description": "DB Parameter Goup",
|
||||
"Family": "MySQL5.1",
|
||||
"Parameters": {
|
||||
"BACKLOG_QUEUE_LIMIT": "2048"
|
||||
}
|
||||
}
|
||||
"Parameters": {"BACKLOG_QUEUE_LIMIT": "2048"},
|
||||
},
|
||||
},
|
||||
|
||||
"DBEC2SecurityGroup": {
|
||||
"Type": "AWS::EC2::SecurityGroup",
|
||||
"Condition": "Is-EC2-VPC",
|
||||
"Properties": {
|
||||
"GroupDescription": "Open database for access",
|
||||
"SecurityGroupIngress": [{
|
||||
"IpProtocol": "tcp",
|
||||
"FromPort": "3306",
|
||||
"ToPort": "3306",
|
||||
"SourceSecurityGroupName": {"Ref": "EC2SecurityGroup"}
|
||||
}]
|
||||
}
|
||||
"SecurityGroupIngress": [
|
||||
{
|
||||
"IpProtocol": "tcp",
|
||||
"FromPort": "3306",
|
||||
"ToPort": "3306",
|
||||
"SourceSecurityGroupName": {"Ref": "EC2SecurityGroup"},
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
"DBSecurityGroup": {
|
||||
"Type": "AWS::RDS::DBSecurityGroup",
|
||||
"Condition": "Is-EC2-Classic",
|
||||
"Properties": {
|
||||
"DBSecurityGroupIngress": [{
|
||||
"EC2SecurityGroupName": {"Ref": "EC2SecurityGroup"}
|
||||
}],
|
||||
"GroupDescription": "database access"
|
||||
}
|
||||
"DBSecurityGroupIngress": [
|
||||
{"EC2SecurityGroupName": {"Ref": "EC2SecurityGroup"}}
|
||||
],
|
||||
"GroupDescription": "database access",
|
||||
},
|
||||
},
|
||||
|
||||
"my_vpc": {
|
||||
"Type": "AWS::EC2::VPC",
|
||||
"Properties": {
|
||||
"CidrBlock": "10.0.0.0/16",
|
||||
}
|
||||
},
|
||||
|
||||
"my_vpc": {"Type": "AWS::EC2::VPC", "Properties": {"CidrBlock": "10.0.0.0/16"}},
|
||||
"EC2Subnet": {
|
||||
"Type": "AWS::EC2::Subnet",
|
||||
"Condition": "Is-EC2-VPC",
|
||||
"Properties": {
|
||||
"AvailabilityZone": "eu-central-1a",
|
||||
"CidrBlock": "10.0.1.0/24",
|
||||
"VpcId": {"Ref": "my_vpc"}
|
||||
}
|
||||
"VpcId": {"Ref": "my_vpc"},
|
||||
},
|
||||
},
|
||||
|
||||
"DBSubnet": {
|
||||
"Type": "AWS::RDS::DBSubnetGroup",
|
||||
"Condition": "Is-EC2-VPC",
|
||||
"Properties": {
|
||||
"DBSubnetGroupDescription": "my db subnet group",
|
||||
"SubnetIds": [{"Ref": "EC2Subnet"}],
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
"MasterDB": {
|
||||
"Type": "AWS::RDS::DBInstance",
|
||||
"Properties": {
|
||||
|
|
@ -151,54 +153,79 @@ template = {
|
|||
"AllocatedStorage": {"Ref": "DBAllocatedStorage"},
|
||||
"DBInstanceClass": {"Ref": "DBInstanceClass"},
|
||||
"Engine": "MySQL",
|
||||
"DBSubnetGroupName": {"Fn::If": ["Is-EC2-VPC", {"Ref": "DBSubnet"}, {"Ref": "AWS::NoValue"}]},
|
||||
"DBSubnetGroupName": {
|
||||
"Fn::If": [
|
||||
"Is-EC2-VPC",
|
||||
{"Ref": "DBSubnet"},
|
||||
{"Ref": "AWS::NoValue"},
|
||||
]
|
||||
},
|
||||
"MasterUsername": {"Ref": "DBUser"},
|
||||
"MasterUserPassword": {"Ref": "DBPassword"},
|
||||
"MultiAZ": {"Ref": "MultiAZ"},
|
||||
"Tags": [{"Key": "Name", "Value": "Master Database"}],
|
||||
"VPCSecurityGroups": {"Fn::If": ["Is-EC2-VPC", [{"Fn::GetAtt": ["DBEC2SecurityGroup", "GroupId"]}], {"Ref": "AWS::NoValue"}]},
|
||||
"DBSecurityGroups": {"Fn::If": ["Is-EC2-Classic", [{"Ref": "DBSecurityGroup"}], {"Ref": "AWS::NoValue"}]}
|
||||
"VPCSecurityGroups": {
|
||||
"Fn::If": [
|
||||
"Is-EC2-VPC",
|
||||
[{"Fn::GetAtt": ["DBEC2SecurityGroup", "GroupId"]}],
|
||||
{"Ref": "AWS::NoValue"},
|
||||
]
|
||||
},
|
||||
"DBSecurityGroups": {
|
||||
"Fn::If": [
|
||||
"Is-EC2-Classic",
|
||||
[{"Ref": "DBSecurityGroup"}],
|
||||
{"Ref": "AWS::NoValue"},
|
||||
]
|
||||
},
|
||||
},
|
||||
"DeletionPolicy": "Snapshot"
|
||||
"DeletionPolicy": "Snapshot",
|
||||
},
|
||||
|
||||
"ReplicaDB": {
|
||||
"Type": "AWS::RDS::DBInstance",
|
||||
"Properties": {
|
||||
"SourceDBInstanceIdentifier": {"Ref": "MasterDB"},
|
||||
"DBInstanceClass": {"Ref": "DBInstanceClass"},
|
||||
"Tags": [{"Key": "Name", "Value": "Read Replica Database"}]
|
||||
}
|
||||
}
|
||||
"Tags": [{"Key": "Name", "Value": "Read Replica Database"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
"Outputs": {
|
||||
"EC2Platform": {
|
||||
"Description": "Platform in which this stack is deployed",
|
||||
"Value": {"Fn::If": ["Is-EC2-VPC", "EC2-VPC", "EC2-Classic"]}
|
||||
"Value": {"Fn::If": ["Is-EC2-VPC", "EC2-VPC", "EC2-Classic"]},
|
||||
},
|
||||
|
||||
"MasterJDBCConnectionString": {
|
||||
"Description": "JDBC connection string for the master database",
|
||||
"Value": {"Fn::Join": ["", ["jdbc:mysql://",
|
||||
{"Fn::GetAtt": [
|
||||
"MasterDB", "Endpoint.Address"]},
|
||||
":",
|
||||
{"Fn::GetAtt": [
|
||||
"MasterDB", "Endpoint.Port"]},
|
||||
"/",
|
||||
{"Ref": "DBName"}]]}
|
||||
"Value": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
"jdbc:mysql://",
|
||||
{"Fn::GetAtt": ["MasterDB", "Endpoint.Address"]},
|
||||
":",
|
||||
{"Fn::GetAtt": ["MasterDB", "Endpoint.Port"]},
|
||||
"/",
|
||||
{"Ref": "DBName"},
|
||||
],
|
||||
]
|
||||
},
|
||||
},
|
||||
"ReplicaJDBCConnectionString": {
|
||||
"Description": "JDBC connection string for the replica database",
|
||||
"Value": {"Fn::Join": ["", ["jdbc:mysql://",
|
||||
{"Fn::GetAtt": [
|
||||
"ReplicaDB", "Endpoint.Address"]},
|
||||
":",
|
||||
{"Fn::GetAtt": [
|
||||
"ReplicaDB", "Endpoint.Port"]},
|
||||
"/",
|
||||
{"Ref": "DBName"}]]}
|
||||
}
|
||||
}
|
||||
"Value": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
"jdbc:mysql://",
|
||||
{"Fn::GetAtt": ["ReplicaDB", "Endpoint.Address"]},
|
||||
":",
|
||||
{"Fn::GetAtt": ["ReplicaDB", "Endpoint.Port"]},
|
||||
"/",
|
||||
{"Ref": "DBName"},
|
||||
],
|
||||
]
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,9 +2,7 @@ from __future__ import unicode_literals
|
|||
|
||||
template = {
|
||||
"AWSTemplateFormatVersion": "2010-09-09",
|
||||
|
||||
"Description": "AWS CloudFormation Sample Template RDS_MySQL_With_Read_Replica: Sample template showing how to create a highly-available, RDS DBInstance with a read replica. **WARNING** This template creates an Amazon Relational Database Service database instance and Amazon CloudWatch alarms. You will be billed for the AWS resources used if you create a stack from this template.",
|
||||
|
||||
"Parameters": {
|
||||
"DBName": {
|
||||
"Default": "MyDatabase",
|
||||
|
|
@ -13,13 +11,9 @@ template = {
|
|||
"MinLength": "1",
|
||||
"MaxLength": "64",
|
||||
"AllowedPattern": "[a-zA-Z][a-zA-Z0-9]*",
|
||||
"ConstraintDescription": "must begin with a letter and contain only alphanumeric characters."
|
||||
"ConstraintDescription": "must begin with a letter and contain only alphanumeric characters.",
|
||||
},
|
||||
|
||||
"DBInstanceIdentifier": {
|
||||
"Type": "String"
|
||||
},
|
||||
|
||||
"DBInstanceIdentifier": {"Type": "String"},
|
||||
"DBUser": {
|
||||
"NoEcho": "true",
|
||||
"Description": "The database admin account username",
|
||||
|
|
@ -27,9 +21,8 @@ template = {
|
|||
"MinLength": "1",
|
||||
"MaxLength": "16",
|
||||
"AllowedPattern": "[a-zA-Z][a-zA-Z0-9]*",
|
||||
"ConstraintDescription": "must begin with a letter and contain only alphanumeric characters."
|
||||
"ConstraintDescription": "must begin with a letter and contain only alphanumeric characters.",
|
||||
},
|
||||
|
||||
"DBPassword": {
|
||||
"NoEcho": "true",
|
||||
"Description": "The database admin account password",
|
||||
|
|
@ -37,101 +30,113 @@ template = {
|
|||
"MinLength": "1",
|
||||
"MaxLength": "41",
|
||||
"AllowedPattern": "[a-zA-Z0-9]+",
|
||||
"ConstraintDescription": "must contain only alphanumeric characters."
|
||||
"ConstraintDescription": "must contain only alphanumeric characters.",
|
||||
},
|
||||
|
||||
"DBAllocatedStorage": {
|
||||
"Default": "5",
|
||||
"Description": "The size of the database (Gb)",
|
||||
"Type": "Number",
|
||||
"MinValue": "5",
|
||||
"MaxValue": "1024",
|
||||
"ConstraintDescription": "must be between 5 and 1024Gb."
|
||||
"ConstraintDescription": "must be between 5 and 1024Gb.",
|
||||
},
|
||||
|
||||
"DBInstanceClass": {
|
||||
"Description": "The database instance type",
|
||||
"Type": "String",
|
||||
"Default": "db.m1.small",
|
||||
"AllowedValues": ["db.t1.micro", "db.m1.small", "db.m1.medium", "db.m1.large", "db.m1.xlarge", "db.m2.xlarge", "db.m2.2xlarge", "db.m2.4xlarge", "db.m3.medium", "db.m3.large", "db.m3.xlarge", "db.m3.2xlarge", "db.r3.large", "db.r3.xlarge", "db.r3.2xlarge", "db.r3.4xlarge", "db.r3.8xlarge", "db.m2.xlarge", "db.m2.2xlarge", "db.m2.4xlarge", "db.cr1.8xlarge"],
|
||||
"ConstraintDescription": "must select a valid database instance type."
|
||||
"AllowedValues": [
|
||||
"db.t1.micro",
|
||||
"db.m1.small",
|
||||
"db.m1.medium",
|
||||
"db.m1.large",
|
||||
"db.m1.xlarge",
|
||||
"db.m2.xlarge",
|
||||
"db.m2.2xlarge",
|
||||
"db.m2.4xlarge",
|
||||
"db.m3.medium",
|
||||
"db.m3.large",
|
||||
"db.m3.xlarge",
|
||||
"db.m3.2xlarge",
|
||||
"db.r3.large",
|
||||
"db.r3.xlarge",
|
||||
"db.r3.2xlarge",
|
||||
"db.r3.4xlarge",
|
||||
"db.r3.8xlarge",
|
||||
"db.m2.xlarge",
|
||||
"db.m2.2xlarge",
|
||||
"db.m2.4xlarge",
|
||||
"db.cr1.8xlarge",
|
||||
],
|
||||
"ConstraintDescription": "must select a valid database instance type.",
|
||||
},
|
||||
|
||||
"EC2SecurityGroup": {
|
||||
"Description": "The EC2 security group that contains instances that need access to the database",
|
||||
"Default": "default",
|
||||
"Type": "String",
|
||||
"AllowedPattern": "[a-zA-Z0-9\\-]+",
|
||||
"ConstraintDescription": "must be a valid security group name."
|
||||
"ConstraintDescription": "must be a valid security group name.",
|
||||
},
|
||||
|
||||
"MultiAZ": {
|
||||
"Description": "Multi-AZ master database",
|
||||
"Type": "String",
|
||||
"Default": "false",
|
||||
"AllowedValues": ["true", "false"],
|
||||
"ConstraintDescription": "must be true or false."
|
||||
}
|
||||
"ConstraintDescription": "must be true or false.",
|
||||
},
|
||||
},
|
||||
|
||||
"Conditions": {
|
||||
"Is-EC2-VPC": {"Fn::Or": [{"Fn::Equals": [{"Ref": "AWS::Region"}, "eu-central-1"]},
|
||||
{"Fn::Equals": [{"Ref": "AWS::Region"}, "cn-north-1"]}]},
|
||||
"Is-EC2-Classic": {"Fn::Not": [{"Condition": "Is-EC2-VPC"}]}
|
||||
"Is-EC2-VPC": {
|
||||
"Fn::Or": [
|
||||
{"Fn::Equals": [{"Ref": "AWS::Region"}, "eu-central-1"]},
|
||||
{"Fn::Equals": [{"Ref": "AWS::Region"}, "cn-north-1"]},
|
||||
]
|
||||
},
|
||||
"Is-EC2-Classic": {"Fn::Not": [{"Condition": "Is-EC2-VPC"}]},
|
||||
},
|
||||
|
||||
"Resources": {
|
||||
"DBEC2SecurityGroup": {
|
||||
"Type": "AWS::EC2::SecurityGroup",
|
||||
"Condition": "Is-EC2-VPC",
|
||||
"Properties": {
|
||||
"GroupDescription": "Open database for access",
|
||||
"SecurityGroupIngress": [{
|
||||
"IpProtocol": "tcp",
|
||||
"FromPort": "3306",
|
||||
"ToPort": "3306",
|
||||
"SourceSecurityGroupName": {"Ref": "EC2SecurityGroup"}
|
||||
}]
|
||||
}
|
||||
"SecurityGroupIngress": [
|
||||
{
|
||||
"IpProtocol": "tcp",
|
||||
"FromPort": "3306",
|
||||
"ToPort": "3306",
|
||||
"SourceSecurityGroupName": {"Ref": "EC2SecurityGroup"},
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
|
||||
"DBSecurityGroup": {
|
||||
"Type": "AWS::RDS::DBSecurityGroup",
|
||||
"Condition": "Is-EC2-Classic",
|
||||
"Properties": {
|
||||
"DBSecurityGroupIngress": [{
|
||||
"EC2SecurityGroupName": {"Ref": "EC2SecurityGroup"}
|
||||
}],
|
||||
"GroupDescription": "database access"
|
||||
}
|
||||
"DBSecurityGroupIngress": [
|
||||
{"EC2SecurityGroupName": {"Ref": "EC2SecurityGroup"}}
|
||||
],
|
||||
"GroupDescription": "database access",
|
||||
},
|
||||
},
|
||||
|
||||
"my_vpc": {
|
||||
"Type": "AWS::EC2::VPC",
|
||||
"Properties": {
|
||||
"CidrBlock": "10.0.0.0/16",
|
||||
}
|
||||
},
|
||||
|
||||
"my_vpc": {"Type": "AWS::EC2::VPC", "Properties": {"CidrBlock": "10.0.0.0/16"}},
|
||||
"EC2Subnet": {
|
||||
"Type": "AWS::EC2::Subnet",
|
||||
"Condition": "Is-EC2-VPC",
|
||||
"Properties": {
|
||||
"AvailabilityZone": "eu-central-1a",
|
||||
"CidrBlock": "10.0.1.0/24",
|
||||
"VpcId": {"Ref": "my_vpc"}
|
||||
}
|
||||
"VpcId": {"Ref": "my_vpc"},
|
||||
},
|
||||
},
|
||||
|
||||
"DBSubnet": {
|
||||
"Type": "AWS::RDS::DBSubnetGroup",
|
||||
"Condition": "Is-EC2-VPC",
|
||||
"Properties": {
|
||||
"DBSubnetGroupDescription": "my db subnet group",
|
||||
"SubnetIds": [{"Ref": "EC2Subnet"}],
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
"MasterDB": {
|
||||
"Type": "AWS::RDS::DBInstance",
|
||||
"Properties": {
|
||||
|
|
@ -140,54 +145,79 @@ template = {
|
|||
"AllocatedStorage": {"Ref": "DBAllocatedStorage"},
|
||||
"DBInstanceClass": {"Ref": "DBInstanceClass"},
|
||||
"Engine": "MySQL",
|
||||
"DBSubnetGroupName": {"Fn::If": ["Is-EC2-VPC", {"Ref": "DBSubnet"}, {"Ref": "AWS::NoValue"}]},
|
||||
"DBSubnetGroupName": {
|
||||
"Fn::If": [
|
||||
"Is-EC2-VPC",
|
||||
{"Ref": "DBSubnet"},
|
||||
{"Ref": "AWS::NoValue"},
|
||||
]
|
||||
},
|
||||
"MasterUsername": {"Ref": "DBUser"},
|
||||
"MasterUserPassword": {"Ref": "DBPassword"},
|
||||
"MultiAZ": {"Ref": "MultiAZ"},
|
||||
"Tags": [{"Key": "Name", "Value": "Master Database"}],
|
||||
"VPCSecurityGroups": {"Fn::If": ["Is-EC2-VPC", [{"Fn::GetAtt": ["DBEC2SecurityGroup", "GroupId"]}], {"Ref": "AWS::NoValue"}]},
|
||||
"DBSecurityGroups": {"Fn::If": ["Is-EC2-Classic", [{"Ref": "DBSecurityGroup"}], {"Ref": "AWS::NoValue"}]}
|
||||
"VPCSecurityGroups": {
|
||||
"Fn::If": [
|
||||
"Is-EC2-VPC",
|
||||
[{"Fn::GetAtt": ["DBEC2SecurityGroup", "GroupId"]}],
|
||||
{"Ref": "AWS::NoValue"},
|
||||
]
|
||||
},
|
||||
"DBSecurityGroups": {
|
||||
"Fn::If": [
|
||||
"Is-EC2-Classic",
|
||||
[{"Ref": "DBSecurityGroup"}],
|
||||
{"Ref": "AWS::NoValue"},
|
||||
]
|
||||
},
|
||||
},
|
||||
"DeletionPolicy": "Snapshot"
|
||||
"DeletionPolicy": "Snapshot",
|
||||
},
|
||||
|
||||
"ReplicaDB": {
|
||||
"Type": "AWS::RDS::DBInstance",
|
||||
"Properties": {
|
||||
"SourceDBInstanceIdentifier": {"Ref": "MasterDB"},
|
||||
"DBInstanceClass": {"Ref": "DBInstanceClass"},
|
||||
"Tags": [{"Key": "Name", "Value": "Read Replica Database"}]
|
||||
}
|
||||
}
|
||||
"Tags": [{"Key": "Name", "Value": "Read Replica Database"}],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
"Outputs": {
|
||||
"EC2Platform": {
|
||||
"Description": "Platform in which this stack is deployed",
|
||||
"Value": {"Fn::If": ["Is-EC2-VPC", "EC2-VPC", "EC2-Classic"]}
|
||||
"Value": {"Fn::If": ["Is-EC2-VPC", "EC2-VPC", "EC2-Classic"]},
|
||||
},
|
||||
|
||||
"MasterJDBCConnectionString": {
|
||||
"Description": "JDBC connection string for the master database",
|
||||
"Value": {"Fn::Join": ["", ["jdbc:mysql://",
|
||||
{"Fn::GetAtt": [
|
||||
"MasterDB", "Endpoint.Address"]},
|
||||
":",
|
||||
{"Fn::GetAtt": [
|
||||
"MasterDB", "Endpoint.Port"]},
|
||||
"/",
|
||||
{"Ref": "DBName"}]]}
|
||||
"Value": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
"jdbc:mysql://",
|
||||
{"Fn::GetAtt": ["MasterDB", "Endpoint.Address"]},
|
||||
":",
|
||||
{"Fn::GetAtt": ["MasterDB", "Endpoint.Port"]},
|
||||
"/",
|
||||
{"Ref": "DBName"},
|
||||
],
|
||||
]
|
||||
},
|
||||
},
|
||||
"ReplicaJDBCConnectionString": {
|
||||
"Description": "JDBC connection string for the replica database",
|
||||
"Value": {"Fn::Join": ["", ["jdbc:mysql://",
|
||||
{"Fn::GetAtt": [
|
||||
"ReplicaDB", "Endpoint.Address"]},
|
||||
":",
|
||||
{"Fn::GetAtt": [
|
||||
"ReplicaDB", "Endpoint.Port"]},
|
||||
"/",
|
||||
{"Ref": "DBName"}]]}
|
||||
}
|
||||
}
|
||||
"Value": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
"jdbc:mysql://",
|
||||
{"Fn::GetAtt": ["ReplicaDB", "Endpoint.Address"]},
|
||||
":",
|
||||
{"Fn::GetAtt": ["ReplicaDB", "Endpoint.Port"]},
|
||||
"/",
|
||||
{"Ref": "DBName"},
|
||||
],
|
||||
]
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,35 +7,35 @@ template = {
|
|||
"Description": "The name of the first database to be created when the cluster is created",
|
||||
"Type": "String",
|
||||
"Default": "dev",
|
||||
"AllowedPattern": "([a-z]|[0-9])+"
|
||||
"AllowedPattern": "([a-z]|[0-9])+",
|
||||
},
|
||||
"ClusterType": {
|
||||
"Description": "The type of cluster",
|
||||
"Type": "String",
|
||||
"Default": "single-node",
|
||||
"AllowedValues": ["single-node", "multi-node"]
|
||||
"AllowedValues": ["single-node", "multi-node"],
|
||||
},
|
||||
"NumberOfNodes": {
|
||||
"Description": "The number of compute nodes in the cluster. For multi-node clusters, the NumberOfNodes parameter must be greater than 1",
|
||||
"Type": "Number",
|
||||
"Default": "1"
|
||||
"Default": "1",
|
||||
},
|
||||
"NodeType": {
|
||||
"Description": "The type of node to be provisioned",
|
||||
"Type": "String",
|
||||
"Default": "dw1.xlarge",
|
||||
"AllowedValues": ["dw1.xlarge", "dw1.8xlarge", "dw2.large", "dw2.8xlarge"]
|
||||
"AllowedValues": ["dw1.xlarge", "dw1.8xlarge", "dw2.large", "dw2.8xlarge"],
|
||||
},
|
||||
"MasterUsername": {
|
||||
"Description": "The user name that is associated with the master user account for the cluster that is being created",
|
||||
"Type": "String",
|
||||
"Default": "defaultuser",
|
||||
"AllowedPattern": "([a-z])([a-z]|[0-9])*"
|
||||
"AllowedPattern": "([a-z])([a-z]|[0-9])*",
|
||||
},
|
||||
"MasterUserPassword": {
|
||||
"MasterUserPassword": {
|
||||
"Description": "The password that is associated with the master user account for the cluster that is being created.",
|
||||
"Type": "String",
|
||||
"NoEcho": "true"
|
||||
"NoEcho": "true",
|
||||
},
|
||||
"InboundTraffic": {
|
||||
"Description": "Allow inbound traffic to the cluster from this CIDR range.",
|
||||
|
|
@ -44,18 +44,16 @@ template = {
|
|||
"MaxLength": "18",
|
||||
"Default": "0.0.0.0/0",
|
||||
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
|
||||
"ConstraintDescription": "must be a valid CIDR range of the form x.x.x.x/x."
|
||||
"ConstraintDescription": "must be a valid CIDR range of the form x.x.x.x/x.",
|
||||
},
|
||||
"PortNumber": {
|
||||
"Description": "The port number on which the cluster accepts incoming connections.",
|
||||
"Type": "Number",
|
||||
"Default": "5439"
|
||||
}
|
||||
"Default": "5439",
|
||||
},
|
||||
},
|
||||
"Conditions": {
|
||||
"IsMultiNodeCluster": {
|
||||
"Fn::Equals": [{"Ref": "ClusterType"}, "multi-node"]
|
||||
}
|
||||
"IsMultiNodeCluster": {"Fn::Equals": [{"Ref": "ClusterType"}, "multi-node"]}
|
||||
},
|
||||
"Resources": {
|
||||
"RedshiftCluster": {
|
||||
|
|
@ -63,7 +61,13 @@ template = {
|
|||
"DependsOn": "AttachGateway",
|
||||
"Properties": {
|
||||
"ClusterType": {"Ref": "ClusterType"},
|
||||
"NumberOfNodes": {"Fn::If": ["IsMultiNodeCluster", {"Ref": "NumberOfNodes"}, {"Ref": "AWS::NoValue"}]},
|
||||
"NumberOfNodes": {
|
||||
"Fn::If": [
|
||||
"IsMultiNodeCluster",
|
||||
{"Ref": "NumberOfNodes"},
|
||||
{"Ref": "AWS::NoValue"},
|
||||
]
|
||||
},
|
||||
"NodeType": {"Ref": "NodeType"},
|
||||
"DBName": {"Ref": "DatabaseName"},
|
||||
"MasterUsername": {"Ref": "MasterUsername"},
|
||||
|
|
@ -72,116 +76,106 @@ template = {
|
|||
"VpcSecurityGroupIds": [{"Ref": "SecurityGroup"}],
|
||||
"ClusterSubnetGroupName": {"Ref": "RedshiftClusterSubnetGroup"},
|
||||
"PubliclyAccessible": "true",
|
||||
"Port": {"Ref": "PortNumber"}
|
||||
}
|
||||
"Port": {"Ref": "PortNumber"},
|
||||
},
|
||||
},
|
||||
"RedshiftClusterParameterGroup": {
|
||||
"Type": "AWS::Redshift::ClusterParameterGroup",
|
||||
"Properties": {
|
||||
"Description": "Cluster parameter group",
|
||||
"ParameterGroupFamily": "redshift-1.0",
|
||||
"Parameters": [{
|
||||
"ParameterName": "enable_user_activity_logging",
|
||||
"ParameterValue": "true"
|
||||
}]
|
||||
}
|
||||
"Parameters": [
|
||||
{
|
||||
"ParameterName": "enable_user_activity_logging",
|
||||
"ParameterValue": "true",
|
||||
}
|
||||
],
|
||||
},
|
||||
},
|
||||
"RedshiftClusterSubnetGroup": {
|
||||
"Type": "AWS::Redshift::ClusterSubnetGroup",
|
||||
"Properties": {
|
||||
"Description": "Cluster subnet group",
|
||||
"SubnetIds": [{"Ref": "PublicSubnet"}]
|
||||
}
|
||||
},
|
||||
"VPC": {
|
||||
"Type": "AWS::EC2::VPC",
|
||||
"Properties": {
|
||||
"CidrBlock": "10.0.0.0/16"
|
||||
}
|
||||
"SubnetIds": [{"Ref": "PublicSubnet"}],
|
||||
},
|
||||
},
|
||||
"VPC": {"Type": "AWS::EC2::VPC", "Properties": {"CidrBlock": "10.0.0.0/16"}},
|
||||
"PublicSubnet": {
|
||||
"Type": "AWS::EC2::Subnet",
|
||||
"Properties": {
|
||||
"CidrBlock": "10.0.0.0/24",
|
||||
"VpcId": {"Ref": "VPC"}
|
||||
}
|
||||
"Properties": {"CidrBlock": "10.0.0.0/24", "VpcId": {"Ref": "VPC"}},
|
||||
},
|
||||
"SecurityGroup": {
|
||||
"Type": "AWS::EC2::SecurityGroup",
|
||||
"Properties": {
|
||||
"GroupDescription": "Security group",
|
||||
"SecurityGroupIngress": [{
|
||||
"CidrIp": {"Ref": "InboundTraffic"},
|
||||
"FromPort": {"Ref": "PortNumber"},
|
||||
"ToPort": {"Ref": "PortNumber"},
|
||||
"IpProtocol": "tcp"
|
||||
}],
|
||||
"VpcId": {"Ref": "VPC"}
|
||||
}
|
||||
},
|
||||
"myInternetGateway": {
|
||||
"Type": "AWS::EC2::InternetGateway"
|
||||
"SecurityGroupIngress": [
|
||||
{
|
||||
"CidrIp": {"Ref": "InboundTraffic"},
|
||||
"FromPort": {"Ref": "PortNumber"},
|
||||
"ToPort": {"Ref": "PortNumber"},
|
||||
"IpProtocol": "tcp",
|
||||
}
|
||||
],
|
||||
"VpcId": {"Ref": "VPC"},
|
||||
},
|
||||
},
|
||||
"myInternetGateway": {"Type": "AWS::EC2::InternetGateway"},
|
||||
"AttachGateway": {
|
||||
"Type": "AWS::EC2::VPCGatewayAttachment",
|
||||
"Properties": {
|
||||
"VpcId": {"Ref": "VPC"},
|
||||
"InternetGatewayId": {"Ref": "myInternetGateway"}
|
||||
}
|
||||
"InternetGatewayId": {"Ref": "myInternetGateway"},
|
||||
},
|
||||
},
|
||||
"PublicRouteTable": {
|
||||
"Type": "AWS::EC2::RouteTable",
|
||||
"Properties": {
|
||||
"VpcId": {
|
||||
"Ref": "VPC"
|
||||
}
|
||||
}
|
||||
"Properties": {"VpcId": {"Ref": "VPC"}},
|
||||
},
|
||||
"PublicRoute": {
|
||||
"Type": "AWS::EC2::Route",
|
||||
"DependsOn": "AttachGateway",
|
||||
"Properties": {
|
||||
"RouteTableId": {
|
||||
"Ref": "PublicRouteTable"
|
||||
},
|
||||
"RouteTableId": {"Ref": "PublicRouteTable"},
|
||||
"DestinationCidrBlock": "0.0.0.0/0",
|
||||
"GatewayId": {
|
||||
"Ref": "myInternetGateway"
|
||||
}
|
||||
}
|
||||
"GatewayId": {"Ref": "myInternetGateway"},
|
||||
},
|
||||
},
|
||||
"PublicSubnetRouteTableAssociation": {
|
||||
"Type": "AWS::EC2::SubnetRouteTableAssociation",
|
||||
"Properties": {
|
||||
"SubnetId": {
|
||||
"Ref": "PublicSubnet"
|
||||
},
|
||||
"RouteTableId": {
|
||||
"Ref": "PublicRouteTable"
|
||||
}
|
||||
}
|
||||
}
|
||||
"SubnetId": {"Ref": "PublicSubnet"},
|
||||
"RouteTableId": {"Ref": "PublicRouteTable"},
|
||||
},
|
||||
},
|
||||
},
|
||||
"Outputs": {
|
||||
"ClusterEndpoint": {
|
||||
"Description": "Cluster endpoint",
|
||||
"Value": {"Fn::Join": [":", [{"Fn::GetAtt": ["RedshiftCluster", "Endpoint.Address"]}, {"Fn::GetAtt": ["RedshiftCluster", "Endpoint.Port"]}]]}
|
||||
"Value": {
|
||||
"Fn::Join": [
|
||||
":",
|
||||
[
|
||||
{"Fn::GetAtt": ["RedshiftCluster", "Endpoint.Address"]},
|
||||
{"Fn::GetAtt": ["RedshiftCluster", "Endpoint.Port"]},
|
||||
],
|
||||
]
|
||||
},
|
||||
},
|
||||
"ClusterName": {
|
||||
"Description": "Name of cluster",
|
||||
"Value": {"Ref": "RedshiftCluster"}
|
||||
"Value": {"Ref": "RedshiftCluster"},
|
||||
},
|
||||
"ParameterGroupName": {
|
||||
"Description": "Name of parameter group",
|
||||
"Value": {"Ref": "RedshiftClusterParameterGroup"}
|
||||
"Value": {"Ref": "RedshiftClusterParameterGroup"},
|
||||
},
|
||||
"RedshiftClusterSubnetGroupName": {
|
||||
"Description": "Name of cluster subnet group",
|
||||
"Value": {"Ref": "RedshiftClusterSubnetGroup"}
|
||||
"Value": {"Ref": "RedshiftClusterSubnetGroup"},
|
||||
},
|
||||
"RedshiftClusterSecurityGroupName": {
|
||||
"Description": "Name of cluster security group",
|
||||
"Value": {"Ref": "SecurityGroup"}
|
||||
}
|
||||
}
|
||||
"Value": {"Ref": "SecurityGroup"},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +1,38 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
template = {
|
||||
"Parameters": {
|
||||
"R53ZoneName": {
|
||||
"Type": "String",
|
||||
"Default": "my_zone"
|
||||
}
|
||||
},
|
||||
|
||||
"Parameters": {"R53ZoneName": {"Type": "String", "Default": "my_zone"}},
|
||||
"Resources": {
|
||||
"Ec2Instance": {
|
||||
"Type": "AWS::EC2::Instance",
|
||||
"Properties": {
|
||||
"ImageId": "ami-1234abcd",
|
||||
"PrivateIpAddress": "10.0.0.25",
|
||||
}
|
||||
"Properties": {"ImageId": "ami-1234abcd", "PrivateIpAddress": "10.0.0.25"},
|
||||
},
|
||||
|
||||
"HostedZone": {
|
||||
"Type": "AWS::Route53::HostedZone",
|
||||
"Properties": {
|
||||
"Name": {"Ref": "R53ZoneName"}
|
||||
}
|
||||
"Properties": {"Name": {"Ref": "R53ZoneName"}},
|
||||
},
|
||||
|
||||
"myDNSRecord": {
|
||||
"Type": "AWS::Route53::RecordSet",
|
||||
"Properties": {
|
||||
"HostedZoneId": {"Ref": "HostedZone"},
|
||||
"Comment": "DNS name for my instance.",
|
||||
"Name": {
|
||||
"Fn::Join": ["", [
|
||||
{"Ref": "Ec2Instance"}, ".",
|
||||
{"Ref": "AWS::Region"}, ".",
|
||||
{"Ref": "R53ZoneName"}, "."
|
||||
]]
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
{"Ref": "Ec2Instance"},
|
||||
".",
|
||||
{"Ref": "AWS::Region"},
|
||||
".",
|
||||
{"Ref": "R53ZoneName"},
|
||||
".",
|
||||
],
|
||||
]
|
||||
},
|
||||
"Type": "A",
|
||||
"TTL": "900",
|
||||
"ResourceRecords": [
|
||||
{"Fn::GetAtt": ["Ec2Instance", "PrivateIp"]}
|
||||
]
|
||||
}
|
||||
}
|
||||
"ResourceRecords": [{"Fn::GetAtt": ["Ec2Instance", "PrivateIp"]}],
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,11 +4,8 @@ template = {
|
|||
"Resources": {
|
||||
"HostedZone": {
|
||||
"Type": "AWS::Route53::HostedZone",
|
||||
"Properties": {
|
||||
"Name": "my_zone"
|
||||
}
|
||||
"Properties": {"Name": "my_zone"},
|
||||
},
|
||||
|
||||
"my_health_check": {
|
||||
"Type": "AWS::Route53::HealthCheck",
|
||||
"Properties": {
|
||||
|
|
@ -20,9 +17,8 @@ template = {
|
|||
"ResourcePath": "/",
|
||||
"Type": "HTTP",
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
|
||||
"myDNSRecord": {
|
||||
"Type": "AWS::Route53::RecordSet",
|
||||
"Properties": {
|
||||
|
|
@ -33,7 +29,7 @@ template = {
|
|||
"TTL": "900",
|
||||
"ResourceRecords": ["my.example.com"],
|
||||
"HealthCheckId": {"Ref": "my_health_check"},
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,53 +2,71 @@ from __future__ import unicode_literals
|
|||
|
||||
template = {
|
||||
"AWSTemplateFormatVersion": "2010-09-09",
|
||||
|
||||
"Description": "AWS CloudFormation Sample Template Route53_RoundRobin: Sample template showing how to use weighted round robin (WRR) DNS entried via Amazon Route 53. This contrived sample uses weighted CNAME records to illustrate that the weighting influences the return records. It assumes that you already have a Hosted Zone registered with Amazon Route 53. **WARNING** This template creates one or more AWS resources. You will be billed for the AWS resources used if you create a stack from this template.",
|
||||
|
||||
"Parameters": {
|
||||
"R53ZoneName": {
|
||||
"Type": "String",
|
||||
"Default": "my_zone"
|
||||
}
|
||||
},
|
||||
|
||||
"Parameters": {"R53ZoneName": {"Type": "String", "Default": "my_zone"}},
|
||||
"Resources": {
|
||||
|
||||
"MyZone": {
|
||||
"Type": "AWS::Route53::HostedZone",
|
||||
"Properties": {
|
||||
"Name": {"Ref": "R53ZoneName"}
|
||||
}
|
||||
"Properties": {"Name": {"Ref": "R53ZoneName"}},
|
||||
},
|
||||
|
||||
"MyDNSRecord": {
|
||||
"Type": "AWS::Route53::RecordSetGroup",
|
||||
"Properties": {
|
||||
"HostedZoneId": {"Ref": "MyZone"},
|
||||
"Comment": "Contrived example to redirect to aws.amazon.com 75% of the time and www.amazon.com 25% of the time.",
|
||||
"RecordSets": [{
|
||||
"SetIdentifier": {"Fn::Join": [" ", [{"Ref": "AWS::StackName"}, "AWS"]]},
|
||||
"Name": {"Fn::Join": ["", [{"Ref": "AWS::StackName"}, ".", {"Ref": "AWS::Region"}, ".", {"Ref": "R53ZoneName"}, "."]]},
|
||||
"Type": "CNAME",
|
||||
"TTL": "900",
|
||||
"ResourceRecords": ["aws.amazon.com"],
|
||||
"Weight": "3"
|
||||
}, {
|
||||
"SetIdentifier": {"Fn::Join": [" ", [{"Ref": "AWS::StackName"}, "Amazon"]]},
|
||||
"Name": {"Fn::Join": ["", [{"Ref": "AWS::StackName"}, ".", {"Ref": "AWS::Region"}, ".", {"Ref": "R53ZoneName"}, "."]]},
|
||||
"Type": "CNAME",
|
||||
"TTL": "900",
|
||||
"ResourceRecords": ["www.amazon.com"],
|
||||
"Weight": "1"
|
||||
}]
|
||||
}
|
||||
}
|
||||
"RecordSets": [
|
||||
{
|
||||
"SetIdentifier": {
|
||||
"Fn::Join": [" ", [{"Ref": "AWS::StackName"}, "AWS"]]
|
||||
},
|
||||
"Name": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
{"Ref": "AWS::StackName"},
|
||||
".",
|
||||
{"Ref": "AWS::Region"},
|
||||
".",
|
||||
{"Ref": "R53ZoneName"},
|
||||
".",
|
||||
],
|
||||
]
|
||||
},
|
||||
"Type": "CNAME",
|
||||
"TTL": "900",
|
||||
"ResourceRecords": ["aws.amazon.com"],
|
||||
"Weight": "3",
|
||||
},
|
||||
{
|
||||
"SetIdentifier": {
|
||||
"Fn::Join": [" ", [{"Ref": "AWS::StackName"}, "Amazon"]]
|
||||
},
|
||||
"Name": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
{"Ref": "AWS::StackName"},
|
||||
".",
|
||||
{"Ref": "AWS::Region"},
|
||||
".",
|
||||
{"Ref": "R53ZoneName"},
|
||||
".",
|
||||
],
|
||||
]
|
||||
},
|
||||
"Type": "CNAME",
|
||||
"TTL": "900",
|
||||
"ResourceRecords": ["www.amazon.com"],
|
||||
"Weight": "1",
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
"Outputs": {
|
||||
"DomainName": {
|
||||
"Description": "Fully qualified domain name",
|
||||
"Value": {"Ref": "MyDNSRecord"}
|
||||
"Value": {"Ref": "MyDNSRecord"},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ template = {
|
|||
"MinLength": "9",
|
||||
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
|
||||
"MaxLength": "18",
|
||||
"Type": "String"
|
||||
"Type": "String",
|
||||
},
|
||||
"KeyName": {
|
||||
"Type": "String",
|
||||
|
|
@ -18,7 +18,7 @@ template = {
|
|||
"MinLength": "1",
|
||||
"AllowedPattern": "[\\x20-\\x7E]*",
|
||||
"MaxLength": "255",
|
||||
"ConstraintDescription": "can contain only ASCII characters."
|
||||
"ConstraintDescription": "can contain only ASCII characters.",
|
||||
},
|
||||
"InstanceType": {
|
||||
"Default": "m1.small",
|
||||
|
|
@ -40,8 +40,8 @@ template = {
|
|||
"c1.xlarge",
|
||||
"cc1.4xlarge",
|
||||
"cc2.8xlarge",
|
||||
"cg1.4xlarge"
|
||||
]
|
||||
"cg1.4xlarge",
|
||||
],
|
||||
},
|
||||
"VolumeSize": {
|
||||
"Description": "WebServer EC2 instance type",
|
||||
|
|
@ -49,8 +49,8 @@ template = {
|
|||
"Type": "Number",
|
||||
"MaxValue": "1024",
|
||||
"MinValue": "5",
|
||||
"ConstraintDescription": "must be between 5 and 1024 Gb."
|
||||
}
|
||||
"ConstraintDescription": "must be between 5 and 1024 Gb.",
|
||||
},
|
||||
},
|
||||
"AWSTemplateFormatVersion": "2010-09-09",
|
||||
"Outputs": {
|
||||
|
|
@ -59,17 +59,9 @@ template = {
|
|||
"Value": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
"http://",
|
||||
{
|
||||
"Fn::GetAtt": [
|
||||
"WebServer",
|
||||
"PublicDnsName"
|
||||
]
|
||||
}
|
||||
]
|
||||
["http://", {"Fn::GetAtt": ["WebServer", "PublicDnsName"]}],
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
"Resources": {
|
||||
|
|
@ -81,19 +73,17 @@ template = {
|
|||
"ToPort": "80",
|
||||
"IpProtocol": "tcp",
|
||||
"CidrIp": "0.0.0.0/0",
|
||||
"FromPort": "80"
|
||||
"FromPort": "80",
|
||||
},
|
||||
{
|
||||
"ToPort": "22",
|
||||
"IpProtocol": "tcp",
|
||||
"CidrIp": {
|
||||
"Ref": "SSHLocation"
|
||||
},
|
||||
"FromPort": "22"
|
||||
}
|
||||
"CidrIp": {"Ref": "SSHLocation"},
|
||||
"FromPort": "22",
|
||||
},
|
||||
],
|
||||
"GroupDescription": "Enable SSH access and HTTP access on the inbound port"
|
||||
}
|
||||
"GroupDescription": "Enable SSH access and HTTP access on the inbound port",
|
||||
},
|
||||
},
|
||||
"WebServer": {
|
||||
"Type": "AWS::EC2::Instance",
|
||||
|
|
@ -108,23 +98,17 @@ template = {
|
|||
"# Helper function\n",
|
||||
"function error_exit\n",
|
||||
"{\n",
|
||||
" /opt/aws/bin/cfn-signal -e 1 -r \"$1\" '",
|
||||
{
|
||||
"Ref": "WaitHandle"
|
||||
},
|
||||
' /opt/aws/bin/cfn-signal -e 1 -r "$1" \'',
|
||||
{"Ref": "WaitHandle"},
|
||||
"'\n",
|
||||
" exit 1\n",
|
||||
"}\n",
|
||||
"# Install Rails packages\n",
|
||||
"/opt/aws/bin/cfn-init -s ",
|
||||
{
|
||||
"Ref": "AWS::StackId"
|
||||
},
|
||||
{"Ref": "AWS::StackId"},
|
||||
" -r WebServer ",
|
||||
" --region ",
|
||||
{
|
||||
"Ref": "AWS::Region"
|
||||
},
|
||||
{"Ref": "AWS::Region"},
|
||||
" || error_exit 'Failed to run cfn-init'\n",
|
||||
"# Wait for the EBS volume to show up\n",
|
||||
"while [ ! -e /dev/sdh ]; do echo Waiting for EBS volume to attach; sleep 5; done\n",
|
||||
|
|
@ -137,56 +121,38 @@ template = {
|
|||
"git init\n",
|
||||
"gollum --port 80 --host 0.0.0.0 &\n",
|
||||
"# If all is well so signal success\n",
|
||||
"/opt/aws/bin/cfn-signal -e $? -r \"Rails application setup complete\" '",
|
||||
{
|
||||
"Ref": "WaitHandle"
|
||||
},
|
||||
"'\n"
|
||||
]
|
||||
'/opt/aws/bin/cfn-signal -e $? -r "Rails application setup complete" \'',
|
||||
{"Ref": "WaitHandle"},
|
||||
"'\n",
|
||||
],
|
||||
]
|
||||
}
|
||||
},
|
||||
"KeyName": {
|
||||
"Ref": "KeyName"
|
||||
},
|
||||
"SecurityGroups": [
|
||||
{
|
||||
"Ref": "WebServerSecurityGroup"
|
||||
}
|
||||
],
|
||||
"InstanceType": {
|
||||
"Ref": "InstanceType"
|
||||
},
|
||||
"KeyName": {"Ref": "KeyName"},
|
||||
"SecurityGroups": [{"Ref": "WebServerSecurityGroup"}],
|
||||
"InstanceType": {"Ref": "InstanceType"},
|
||||
"ImageId": {
|
||||
"Fn::FindInMap": [
|
||||
"AWSRegionArch2AMI",
|
||||
{
|
||||
"Ref": "AWS::Region"
|
||||
},
|
||||
{"Ref": "AWS::Region"},
|
||||
{
|
||||
"Fn::FindInMap": [
|
||||
"AWSInstanceType2Arch",
|
||||
{
|
||||
"Ref": "InstanceType"
|
||||
},
|
||||
"Arch"
|
||||
{"Ref": "InstanceType"},
|
||||
"Arch",
|
||||
]
|
||||
}
|
||||
},
|
||||
]
|
||||
}
|
||||
},
|
||||
},
|
||||
"Metadata": {
|
||||
"AWS::CloudFormation::Init": {
|
||||
"config": {
|
||||
"packages": {
|
||||
"rubygems": {
|
||||
"nokogiri": [
|
||||
"1.5.10"
|
||||
],
|
||||
"nokogiri": ["1.5.10"],
|
||||
"rdiscount": [],
|
||||
"gollum": [
|
||||
"1.1.1"
|
||||
]
|
||||
"gollum": ["1.1.1"],
|
||||
},
|
||||
"yum": {
|
||||
"libxslt-devel": [],
|
||||
|
|
@ -196,150 +162,99 @@ template = {
|
|||
"ruby-devel": [],
|
||||
"ruby-rdoc": [],
|
||||
"make": [],
|
||||
"libxml2-devel": []
|
||||
}
|
||||
"libxml2-devel": [],
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
"DataVolume": {
|
||||
"Type": "AWS::EC2::Volume",
|
||||
"Properties": {
|
||||
"Tags": [
|
||||
{
|
||||
"Value": "Gollum Data Volume",
|
||||
"Key": "Usage"
|
||||
}
|
||||
],
|
||||
"AvailabilityZone": {
|
||||
"Fn::GetAtt": [
|
||||
"WebServer",
|
||||
"AvailabilityZone"
|
||||
]
|
||||
},
|
||||
"Tags": [{"Value": "Gollum Data Volume", "Key": "Usage"}],
|
||||
"AvailabilityZone": {"Fn::GetAtt": ["WebServer", "AvailabilityZone"]},
|
||||
"Size": "100",
|
||||
}
|
||||
},
|
||||
},
|
||||
"MountPoint": {
|
||||
"Type": "AWS::EC2::VolumeAttachment",
|
||||
"Properties": {
|
||||
"InstanceId": {
|
||||
"Ref": "WebServer"
|
||||
},
|
||||
"InstanceId": {"Ref": "WebServer"},
|
||||
"Device": "/dev/sdh",
|
||||
"VolumeId": {
|
||||
"Ref": "DataVolume"
|
||||
}
|
||||
}
|
||||
"VolumeId": {"Ref": "DataVolume"},
|
||||
},
|
||||
},
|
||||
"WaitCondition": {
|
||||
"DependsOn": "MountPoint",
|
||||
"Type": "AWS::CloudFormation::WaitCondition",
|
||||
"Properties": {
|
||||
"Handle": {
|
||||
"Ref": "WaitHandle"
|
||||
},
|
||||
"Timeout": "300"
|
||||
},
|
||||
"Properties": {"Handle": {"Ref": "WaitHandle"}, "Timeout": "300"},
|
||||
"Metadata": {
|
||||
"Comment1": "Note that the WaitCondition is dependent on the volume mount point allowing the volume to be created and attached to the EC2 instance",
|
||||
"Comment2": "The instance bootstrap script waits for the volume to be attached to the instance prior to installing Gollum and signalling completion"
|
||||
}
|
||||
"Comment2": "The instance bootstrap script waits for the volume to be attached to the instance prior to installing Gollum and signalling completion",
|
||||
},
|
||||
},
|
||||
"WaitHandle": {
|
||||
"Type": "AWS::CloudFormation::WaitConditionHandle"
|
||||
}
|
||||
"WaitHandle": {"Type": "AWS::CloudFormation::WaitConditionHandle"},
|
||||
},
|
||||
"Mappings": {
|
||||
"AWSInstanceType2Arch": {
|
||||
"m3.2xlarge": {
|
||||
"Arch": "64"
|
||||
},
|
||||
"m2.2xlarge": {
|
||||
"Arch": "64"
|
||||
},
|
||||
"m1.small": {
|
||||
"Arch": "64"
|
||||
},
|
||||
"c1.medium": {
|
||||
"Arch": "64"
|
||||
},
|
||||
"cg1.4xlarge": {
|
||||
"Arch": "64HVM"
|
||||
},
|
||||
"m2.xlarge": {
|
||||
"Arch": "64"
|
||||
},
|
||||
"t1.micro": {
|
||||
"Arch": "64"
|
||||
},
|
||||
"cc1.4xlarge": {
|
||||
"Arch": "64HVM"
|
||||
},
|
||||
"m1.medium": {
|
||||
"Arch": "64"
|
||||
},
|
||||
"cc2.8xlarge": {
|
||||
"Arch": "64HVM"
|
||||
},
|
||||
"m1.large": {
|
||||
"Arch": "64"
|
||||
},
|
||||
"m1.xlarge": {
|
||||
"Arch": "64"
|
||||
},
|
||||
"m2.4xlarge": {
|
||||
"Arch": "64"
|
||||
},
|
||||
"c1.xlarge": {
|
||||
"Arch": "64"
|
||||
},
|
||||
"m3.xlarge": {
|
||||
"Arch": "64"
|
||||
}
|
||||
"m3.2xlarge": {"Arch": "64"},
|
||||
"m2.2xlarge": {"Arch": "64"},
|
||||
"m1.small": {"Arch": "64"},
|
||||
"c1.medium": {"Arch": "64"},
|
||||
"cg1.4xlarge": {"Arch": "64HVM"},
|
||||
"m2.xlarge": {"Arch": "64"},
|
||||
"t1.micro": {"Arch": "64"},
|
||||
"cc1.4xlarge": {"Arch": "64HVM"},
|
||||
"m1.medium": {"Arch": "64"},
|
||||
"cc2.8xlarge": {"Arch": "64HVM"},
|
||||
"m1.large": {"Arch": "64"},
|
||||
"m1.xlarge": {"Arch": "64"},
|
||||
"m2.4xlarge": {"Arch": "64"},
|
||||
"c1.xlarge": {"Arch": "64"},
|
||||
"m3.xlarge": {"Arch": "64"},
|
||||
},
|
||||
"AWSRegionArch2AMI": {
|
||||
"ap-southeast-1": {
|
||||
"64HVM": "NOT_YET_SUPPORTED",
|
||||
"32": "ami-b4b0cae6",
|
||||
"64": "ami-beb0caec"
|
||||
"64": "ami-beb0caec",
|
||||
},
|
||||
"ap-southeast-2": {
|
||||
"64HVM": "NOT_YET_SUPPORTED",
|
||||
"32": "ami-b3990e89",
|
||||
"64": "ami-bd990e87"
|
||||
"64": "ami-bd990e87",
|
||||
},
|
||||
"us-west-2": {
|
||||
"64HVM": "NOT_YET_SUPPORTED",
|
||||
"32": "ami-38fe7308",
|
||||
"64": "ami-30fe7300"
|
||||
"64": "ami-30fe7300",
|
||||
},
|
||||
"us-east-1": {
|
||||
"64HVM": "ami-0da96764",
|
||||
"32": "ami-31814f58",
|
||||
"64": "ami-1b814f72"
|
||||
"64": "ami-1b814f72",
|
||||
},
|
||||
"ap-northeast-1": {
|
||||
"64HVM": "NOT_YET_SUPPORTED",
|
||||
"32": "ami-0644f007",
|
||||
"64": "ami-0a44f00b"
|
||||
"64": "ami-0a44f00b",
|
||||
},
|
||||
"us-west-1": {
|
||||
"64HVM": "NOT_YET_SUPPORTED",
|
||||
"32": "ami-11d68a54",
|
||||
"64": "ami-1bd68a5e"
|
||||
"64": "ami-1bd68a5e",
|
||||
},
|
||||
"eu-west-1": {
|
||||
"64HVM": "NOT_YET_SUPPORTED",
|
||||
"32": "ami-973b06e3",
|
||||
"64": "ami-953b06e1"
|
||||
"64": "ami-953b06e1",
|
||||
},
|
||||
"sa-east-1": {
|
||||
"64HVM": "NOT_YET_SUPPORTED",
|
||||
"32": "ami-3e3be423",
|
||||
"64": "ami-3c3be421"
|
||||
}
|
||||
}
|
||||
}
|
||||
"64": "ami-3c3be421",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,12 +1,5 @@
|
|||
from __future__ import unicode_literals
|
||||
|
||||
template = {
|
||||
"Resources": {
|
||||
"VPCEIP": {
|
||||
"Type": "AWS::EC2::EIP",
|
||||
"Properties": {
|
||||
"Domain": "vpc"
|
||||
}
|
||||
}
|
||||
}
|
||||
"Resources": {"VPCEIP": {"Type": "AWS::EC2::EIP", "Properties": {"Domain": "vpc"}}}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,33 +6,26 @@ template = {
|
|||
"Resources": {
|
||||
"ENI": {
|
||||
"Type": "AWS::EC2::NetworkInterface",
|
||||
"Properties": {
|
||||
"SubnetId": {"Ref": "Subnet"}
|
||||
}
|
||||
"Properties": {"SubnetId": {"Ref": "Subnet"}},
|
||||
},
|
||||
"Subnet": {
|
||||
"Type": "AWS::EC2::Subnet",
|
||||
"Properties": {
|
||||
"AvailabilityZone": "us-east-1a",
|
||||
"VpcId": {"Ref": "VPC"},
|
||||
"CidrBlock": "10.0.0.0/24"
|
||||
}
|
||||
"CidrBlock": "10.0.0.0/24",
|
||||
},
|
||||
},
|
||||
"VPC": {
|
||||
"Type": "AWS::EC2::VPC",
|
||||
"Properties": {
|
||||
"CidrBlock": "10.0.0.0/16"
|
||||
}
|
||||
}
|
||||
"VPC": {"Type": "AWS::EC2::VPC", "Properties": {"CidrBlock": "10.0.0.0/16"}},
|
||||
},
|
||||
"Outputs": {
|
||||
"NinjaENI": {
|
||||
"Description": "Elastic IP mapping to Auto-Scaling Group",
|
||||
"Value": {"Ref": "ENI"}
|
||||
"Value": {"Ref": "ENI"},
|
||||
},
|
||||
"ENIIpAddress": {
|
||||
"Description": "ENI's Private IP address",
|
||||
"Value": {"Fn::GetAtt": ["ENI", "PrimaryPrivateIpAddress"]}
|
||||
}
|
||||
}
|
||||
"Value": {"Fn::GetAtt": ["ENI", "PrimaryPrivateIpAddress"]},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ template = {
|
|||
"MinLength": "9",
|
||||
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
|
||||
"MaxLength": "18",
|
||||
"Type": "String"
|
||||
"Type": "String",
|
||||
},
|
||||
"KeyName": {
|
||||
"Type": "String",
|
||||
|
|
@ -18,7 +18,7 @@ template = {
|
|||
"MinLength": "1",
|
||||
"AllowedPattern": "[\\x20-\\x7E]*",
|
||||
"MaxLength": "255",
|
||||
"ConstraintDescription": "can contain only ASCII characters."
|
||||
"ConstraintDescription": "can contain only ASCII characters.",
|
||||
},
|
||||
"InstanceType": {
|
||||
"Default": "m1.small",
|
||||
|
|
@ -40,9 +40,9 @@ template = {
|
|||
"c1.xlarge",
|
||||
"cc1.4xlarge",
|
||||
"cc2.8xlarge",
|
||||
"cg1.4xlarge"
|
||||
]
|
||||
}
|
||||
"cg1.4xlarge",
|
||||
],
|
||||
},
|
||||
},
|
||||
"AWSTemplateFormatVersion": "2010-09-09",
|
||||
"Outputs": {
|
||||
|
|
@ -51,116 +51,61 @@ template = {
|
|||
"Value": {
|
||||
"Fn::Join": [
|
||||
"",
|
||||
[
|
||||
"http://",
|
||||
{
|
||||
"Fn::GetAtt": [
|
||||
"WebServerInstance",
|
||||
"PublicIp"
|
||||
]
|
||||
}
|
||||
]
|
||||
["http://", {"Fn::GetAtt": ["WebServerInstance", "PublicIp"]}],
|
||||
]
|
||||
}
|
||||
},
|
||||
}
|
||||
},
|
||||
"Resources": {
|
||||
"Subnet": {
|
||||
"Type": "AWS::EC2::Subnet",
|
||||
"Properties": {
|
||||
"VpcId": {
|
||||
"Ref": "VPC"
|
||||
},
|
||||
"VpcId": {"Ref": "VPC"},
|
||||
"CidrBlock": "10.0.0.0/24",
|
||||
"Tags": [
|
||||
{
|
||||
"Value": {
|
||||
"Ref": "AWS::StackId"
|
||||
},
|
||||
"Key": "Application"
|
||||
}
|
||||
]
|
||||
}
|
||||
},
|
||||
"WebServerWaitHandle": {
|
||||
"Type": "AWS::CloudFormation::WaitConditionHandle"
|
||||
"Tags": [{"Value": {"Ref": "AWS::StackId"}, "Key": "Application"}],
|
||||
},
|
||||
},
|
||||
"WebServerWaitHandle": {"Type": "AWS::CloudFormation::WaitConditionHandle"},
|
||||
"Route": {
|
||||
"Type": "AWS::EC2::Route",
|
||||
"Properties": {
|
||||
"GatewayId": {
|
||||
"Ref": "InternetGateway"
|
||||
},
|
||||
"GatewayId": {"Ref": "InternetGateway"},
|
||||
"DestinationCidrBlock": "0.0.0.0/0",
|
||||
"RouteTableId": {
|
||||
"Ref": "RouteTable"
|
||||
}
|
||||
"RouteTableId": {"Ref": "RouteTable"},
|
||||
},
|
||||
"DependsOn": "AttachGateway"
|
||||
"DependsOn": "AttachGateway",
|
||||
},
|
||||
"SubnetRouteTableAssociation": {
|
||||
"Type": "AWS::EC2::SubnetRouteTableAssociation",
|
||||
"Properties": {
|
||||
"SubnetId": {
|
||||
"Ref": "Subnet"
|
||||
},
|
||||
"RouteTableId": {
|
||||
"Ref": "RouteTable"
|
||||
}
|
||||
}
|
||||
"SubnetId": {"Ref": "Subnet"},
|
||||
"RouteTableId": {"Ref": "RouteTable"},
|
||||
},
|
||||
},
|
||||
"InternetGateway": {
|
||||
"Type": "AWS::EC2::InternetGateway",
|
||||
"Properties": {
|
||||
"Tags": [
|
||||
{
|
||||
"Value": {
|
||||
"Ref": "AWS::StackId"
|
||||
},
|
||||
"Key": "Application"
|
||||
}
|
||||
]
|
||||
}
|
||||
"Tags": [{"Value": {"Ref": "AWS::StackId"}, "Key": "Application"}]
|
||||
},
|
||||
},
|
||||
"RouteTable": {
|
||||
"Type": "AWS::EC2::RouteTable",
|
||||
"Properties": {
|
||||
"VpcId": {
|
||||
"Ref": "VPC"
|
||||
},
|
||||
"Tags": [
|
||||
{
|
||||
"Value": {
|
||||
"Ref": "AWS::StackId"
|
||||
},
|
||||
"Key": "Application"
|
||||
}
|
||||
]
|
||||
}
|
||||
"VpcId": {"Ref": "VPC"},
|
||||
"Tags": [{"Value": {"Ref": "AWS::StackId"}, "Key": "Application"}],
|
||||
},
|
||||
},
|
||||
"WebServerWaitCondition": {
|
||||
"Type": "AWS::CloudFormation::WaitCondition",
|
||||
"Properties": {
|
||||
"Handle": {
|
||||
"Ref": "WebServerWaitHandle"
|
||||
},
|
||||
"Timeout": "300"
|
||||
},
|
||||
"DependsOn": "WebServerInstance"
|
||||
"Properties": {"Handle": {"Ref": "WebServerWaitHandle"}, "Timeout": "300"},
|
||||
"DependsOn": "WebServerInstance",
|
||||
},
|
||||
"VPC": {
|
||||
"Type": "AWS::EC2::VPC",
|
||||
"Properties": {
|
||||
"CidrBlock": "10.0.0.0/16",
|
||||
"Tags": [
|
||||
{
|
||||
"Value": {
|
||||
"Ref": "AWS::StackId"
|
||||
},
|
||||
"Key": "Application"
|
||||
}
|
||||
]
|
||||
}
|
||||
"Tags": [{"Value": {"Ref": "AWS::StackId"}, "Key": "Application"}],
|
||||
},
|
||||
},
|
||||
"InstanceSecurityGroup": {
|
||||
"Type": "AWS::EC2::SecurityGroup",
|
||||
|
|
@ -169,23 +114,19 @@ template = {
|
|||
{
|
||||
"ToPort": "22",
|
||||
"IpProtocol": "tcp",
|
||||
"CidrIp": {
|
||||
"Ref": "SSHLocation"
|
||||
},
|
||||
"FromPort": "22"
|
||||
"CidrIp": {"Ref": "SSHLocation"},
|
||||
"FromPort": "22",
|
||||
},
|
||||
{
|
||||
"ToPort": "80",
|
||||
"IpProtocol": "tcp",
|
||||
"CidrIp": "0.0.0.0/0",
|
||||
"FromPort": "80"
|
||||
}
|
||||
"FromPort": "80",
|
||||
},
|
||||
],
|
||||
"VpcId": {
|
||||
"Ref": "VPC"
|
||||
},
|
||||
"GroupDescription": "Enable SSH access via port 22"
|
||||
}
|
||||
"VpcId": {"Ref": "VPC"},
|
||||
"GroupDescription": "Enable SSH access via port 22",
|
||||
},
|
||||
},
|
||||
"WebServerInstance": {
|
||||
"Type": "AWS::EC2::Instance",
|
||||
|
|
@ -200,71 +141,39 @@ template = {
|
|||
"# Helper function\n",
|
||||
"function error_exit\n",
|
||||
"{\n",
|
||||
" /opt/aws/bin/cfn-signal -e 1 -r \"$1\" '",
|
||||
{
|
||||
"Ref": "WebServerWaitHandle"
|
||||
},
|
||||
' /opt/aws/bin/cfn-signal -e 1 -r "$1" \'',
|
||||
{"Ref": "WebServerWaitHandle"},
|
||||
"'\n",
|
||||
" exit 1\n",
|
||||
"}\n",
|
||||
"# Install the simple web page\n",
|
||||
"/opt/aws/bin/cfn-init -s ",
|
||||
{
|
||||
"Ref": "AWS::StackId"
|
||||
},
|
||||
{"Ref": "AWS::StackId"},
|
||||
" -r WebServerInstance ",
|
||||
" --region ",
|
||||
{
|
||||
"Ref": "AWS::Region"
|
||||
},
|
||||
{"Ref": "AWS::Region"},
|
||||
" || error_exit 'Failed to run cfn-init'\n",
|
||||
"# Start up the cfn-hup daemon to listen for changes to the Web Server metadata\n",
|
||||
"/opt/aws/bin/cfn-hup || error_exit 'Failed to start cfn-hup'\n",
|
||||
"# All done so signal success\n",
|
||||
"/opt/aws/bin/cfn-signal -e 0 -r \"WebServer setup complete\" '",
|
||||
{
|
||||
"Ref": "WebServerWaitHandle"
|
||||
},
|
||||
"'\n"
|
||||
]
|
||||
'/opt/aws/bin/cfn-signal -e 0 -r "WebServer setup complete" \'',
|
||||
{"Ref": "WebServerWaitHandle"},
|
||||
"'\n",
|
||||
],
|
||||
]
|
||||
}
|
||||
},
|
||||
"Tags": [
|
||||
{
|
||||
"Value": {
|
||||
"Ref": "AWS::StackId"
|
||||
},
|
||||
"Key": "Application"
|
||||
},
|
||||
{
|
||||
"Value": "Bar",
|
||||
"Key": "Foo"
|
||||
}
|
||||
{"Value": {"Ref": "AWS::StackId"}, "Key": "Application"},
|
||||
{"Value": "Bar", "Key": "Foo"},
|
||||
],
|
||||
"SecurityGroupIds": [
|
||||
{
|
||||
"Ref": "InstanceSecurityGroup"
|
||||
}
|
||||
],
|
||||
"KeyName": {
|
||||
"Ref": "KeyName"
|
||||
},
|
||||
"SubnetId": {
|
||||
"Ref": "Subnet"
|
||||
},
|
||||
"SecurityGroupIds": [{"Ref": "InstanceSecurityGroup"}],
|
||||
"KeyName": {"Ref": "KeyName"},
|
||||
"SubnetId": {"Ref": "Subnet"},
|
||||
"ImageId": {
|
||||
"Fn::FindInMap": [
|
||||
"RegionMap",
|
||||
{
|
||||
"Ref": "AWS::Region"
|
||||
},
|
||||
"AMI"
|
||||
]
|
||||
"Fn::FindInMap": ["RegionMap", {"Ref": "AWS::Region"}, "AMI"]
|
||||
},
|
||||
"InstanceType": {
|
||||
"Ref": "InstanceType"
|
||||
}
|
||||
"InstanceType": {"Ref": "InstanceType"},
|
||||
},
|
||||
"Metadata": {
|
||||
"Comment": "Install a simple PHP application",
|
||||
|
|
@ -278,21 +187,17 @@ template = {
|
|||
[
|
||||
"[main]\n",
|
||||
"stack=",
|
||||
{
|
||||
"Ref": "AWS::StackId"
|
||||
},
|
||||
{"Ref": "AWS::StackId"},
|
||||
"\n",
|
||||
"region=",
|
||||
{
|
||||
"Ref": "AWS::Region"
|
||||
},
|
||||
"\n"
|
||||
]
|
||||
{"Ref": "AWS::Region"},
|
||||
"\n",
|
||||
],
|
||||
]
|
||||
},
|
||||
"owner": "root",
|
||||
"group": "root",
|
||||
"mode": "000400"
|
||||
"mode": "000400",
|
||||
},
|
||||
"/etc/cfn/hooks.d/cfn-auto-reloader.conf": {
|
||||
"content": {
|
||||
|
|
@ -303,17 +208,13 @@ template = {
|
|||
"triggers=post.update\n",
|
||||
"path=Resources.WebServerInstance.Metadata.AWS::CloudFormation::Init\n",
|
||||
"action=/opt/aws/bin/cfn-init -s ",
|
||||
{
|
||||
"Ref": "AWS::StackId"
|
||||
},
|
||||
{"Ref": "AWS::StackId"},
|
||||
" -r WebServerInstance ",
|
||||
" --region ",
|
||||
{
|
||||
"Ref": "AWS::Region"
|
||||
},
|
||||
{"Ref": "AWS::Region"},
|
||||
"\n",
|
||||
"runas=root\n"
|
||||
]
|
||||
"runas=root\n",
|
||||
],
|
||||
]
|
||||
}
|
||||
},
|
||||
|
|
@ -324,85 +225,52 @@ template = {
|
|||
[
|
||||
"<?php\n",
|
||||
"echo '<h1>AWS CloudFormation sample PHP application</h1>';\n",
|
||||
"?>\n"
|
||||
]
|
||||
"?>\n",
|
||||
],
|
||||
]
|
||||
},
|
||||
"owner": "apache",
|
||||
"group": "apache",
|
||||
"mode": "000644"
|
||||
}
|
||||
"mode": "000644",
|
||||
},
|
||||
},
|
||||
"services": {
|
||||
"sysvinit": {
|
||||
"httpd": {
|
||||
"ensureRunning": "true",
|
||||
"enabled": "true"
|
||||
},
|
||||
"httpd": {"ensureRunning": "true", "enabled": "true"},
|
||||
"sendmail": {
|
||||
"ensureRunning": "false",
|
||||
"enabled": "false"
|
||||
}
|
||||
"enabled": "false",
|
||||
},
|
||||
}
|
||||
},
|
||||
"packages": {
|
||||
"yum": {
|
||||
"httpd": [],
|
||||
"php": []
|
||||
}
|
||||
}
|
||||
"packages": {"yum": {"httpd": [], "php": []}},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
"IPAddress": {
|
||||
"Type": "AWS::EC2::EIP",
|
||||
"Properties": {
|
||||
"InstanceId": {
|
||||
"Ref": "WebServerInstance"
|
||||
},
|
||||
"Domain": "vpc"
|
||||
},
|
||||
"DependsOn": "AttachGateway"
|
||||
"Properties": {"InstanceId": {"Ref": "WebServerInstance"}, "Domain": "vpc"},
|
||||
"DependsOn": "AttachGateway",
|
||||
},
|
||||
"AttachGateway": {
|
||||
"Type": "AWS::EC2::VPCGatewayAttachment",
|
||||
"Properties": {
|
||||
"VpcId": {
|
||||
"Ref": "VPC"
|
||||
},
|
||||
"InternetGatewayId": {
|
||||
"Ref": "InternetGateway"
|
||||
}
|
||||
}
|
||||
}
|
||||
"VpcId": {"Ref": "VPC"},
|
||||
"InternetGatewayId": {"Ref": "InternetGateway"},
|
||||
},
|
||||
},
|
||||
},
|
||||
"Mappings": {
|
||||
"RegionMap": {
|
||||
"ap-southeast-1": {
|
||||
"AMI": "ami-74dda626"
|
||||
},
|
||||
"ap-southeast-2": {
|
||||
"AMI": "ami-b3990e89"
|
||||
},
|
||||
"us-west-2": {
|
||||
"AMI": "ami-16fd7026"
|
||||
},
|
||||
"us-east-1": {
|
||||
"AMI": "ami-7f418316"
|
||||
},
|
||||
"ap-northeast-1": {
|
||||
"AMI": "ami-dcfa4edd"
|
||||
},
|
||||
"us-west-1": {
|
||||
"AMI": "ami-951945d0"
|
||||
},
|
||||
"eu-west-1": {
|
||||
"AMI": "ami-24506250"
|
||||
},
|
||||
"sa-east-1": {
|
||||
"AMI": "ami-3e3be423"
|
||||
}
|
||||
"ap-southeast-1": {"AMI": "ami-74dda626"},
|
||||
"ap-southeast-2": {"AMI": "ami-b3990e89"},
|
||||
"us-west-2": {"AMI": "ami-16fd7026"},
|
||||
"us-east-1": {"AMI": "ami-7f418316"},
|
||||
"ap-northeast-1": {"AMI": "ami-dcfa4edd"},
|
||||
"us-west-1": {"AMI": "ami-951945d0"},
|
||||
"eu-west-1": {"AMI": "ami-24506250"},
|
||||
"sa-east-1": {"AMI": "ami-3e3be423"},
|
||||
}
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue