-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
2,278 additions
and
0 deletions.
There are no files selected for viewing
932 changes: 932 additions & 0 deletions
932
lamp-single-instance-with-creation-policy.template.json
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
{ | ||
"AWSTemplateFormatVersion": "2010-09-09", | ||
"Description": "Nested Stacks", | ||
"Parameters": { | ||
"KeyName": { | ||
"Description": "Existing KeyPair", | ||
"Type": "AWS::EC2::KeyPair::KeyName", | ||
"ConstraintDescription": "Must be an existing key pair" | ||
}, | ||
"VPCCIDR": { | ||
"Description": "VPC CIDR", | ||
"Type": "String", | ||
"Default": "10.0.0.0/16", | ||
}, | ||
"SubnetCIDR": { | ||
"Description": "Subnet CIDR", | ||
"Type": "String", | ||
"Default": "10.0.2.0/24", | ||
} | ||
}, | ||
"Resources": { | ||
"VPCStack": { | ||
"Type": "AWS::CloudFormation::Stack", | ||
"Properties": { | ||
"TemplateURL": "https://s3.amazonaws.com/.../VPC.template.json", | ||
"Parameters": { | ||
"KeyPairName": { | ||
"Ref": "KeyName" | ||
}, | ||
"VPCCIDR": { | ||
"Ref": "VPCCIDR" | ||
}, | ||
"SubnetCIDR": { | ||
"Ref": "SubnetCIDR" | ||
} | ||
} | ||
} | ||
}, | ||
"DatabaseStack": { | ||
"Type": "AWS::CloudFormation::Stack", | ||
"Properties": { | ||
"TemplateURL": "https://s3.amazonaws.com/.../Database.template.json", | ||
"Parameters": { | ||
"KeyPairName": { | ||
"Ref": "KeyName" | ||
}, | ||
"SubnetId": { | ||
"Fn::GetAtt": [ | ||
"VPCStack", | ||
"Outputs.SubnetId" | ||
] | ||
}, | ||
"VPCId": { | ||
"Fn::GetAtt": [ | ||
"VPCStack", | ||
"Outputs.VPCId" | ||
] | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
{ | ||
"AWSTemplateFormatVersion" : "2010-09-09", | ||
"Mappings" : { | ||
"RegionMap" : { | ||
"us-east-1" : { | ||
"AMI" : "ami-0ff8a91507f77f867" | ||
}, | ||
"us-west-1" : { | ||
"AMI" : "ami-0bdb828fd58c52235" | ||
}, | ||
"eu-west-1" : { | ||
"AMI" : "ami-047bb4163c506cd98" | ||
}, | ||
"ap-northeast-1" : { | ||
"AMI" : "ami-06cd52961ce9f0d85" | ||
}, | ||
"ap-southeast-1" : { | ||
"AMI" : "ami-08569b978cc4dfa10" | ||
} | ||
} | ||
}, | ||
"Resources" : { | ||
"Ec2Instance" : { | ||
"Type" : "AWS::EC2::Instance", | ||
"Properties" : { | ||
"ImageId": { | ||
"Fn::FindInMap": [ | ||
"RegionMap", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
"AMI" | ||
] | ||
} | ||
}, | ||
"DependsOn" : "myDB" | ||
}, | ||
"myDB" : { | ||
"Type" : "AWS::RDS::DBInstance", | ||
"Properties" : { | ||
"AllocatedStorage" : "5", | ||
"DBInstanceClass" : "db.m1.small", | ||
"Engine" : "MySQL", | ||
"EngineVersion" : "5.5", | ||
"MasterUsername" : "MyName", | ||
"MasterUserPassword" : "MyPassword" | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
{ | ||
"AWSTemplateFormatVersion": "2010-09-09", | ||
"Description": "Launch single EC2 Instance", | ||
"Resources": { | ||
"MyInstance": { | ||
"Type": "AWS::EC2::Instance", | ||
"Properties": { | ||
"AvailabilityZone": "us-east-1a", | ||
"InstanceType": {"Ref": "InstanceType"}, | ||
"ImageId": "ami-0baf67670ca0f3719", | ||
"SecurityGroups": [ | ||
{ | ||
"Ref": "MySG" | ||
} | ||
], | ||
"KeyName": {"Ref": "KeyName"}, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "Test Instance" | ||
} | ||
] | ||
} | ||
}, | ||
"MySG": { | ||
"Type": "AWS::EC2::SecurityGroup", | ||
"Properties": { | ||
"GroupDescription": "Enable HTTP & SSH access", | ||
"SecurityGroupIngress": [ | ||
{ | ||
"IpProtocol": "tcp", | ||
"FromPort": "22", | ||
"ToPort": "22", | ||
"CidrIp": "0.0.0.0/0" | ||
}, | ||
{ | ||
"IpProtocol": "tcp", | ||
"FromPort": "80", | ||
"ToPort": "80", | ||
"CidrIp": "0.0.0.0/0" | ||
} | ||
] | ||
} | ||
}, | ||
"MountPoint": { | ||
"Type": "AWS::EC2::VolumeAttachment", | ||
"Condition": "CreateProdResources", | ||
"Properties": { | ||
"InstanceId": { | ||
"Ref": "MyInstance" | ||
}, | ||
"VolumeId": { | ||
"Ref": "NewVolume" | ||
}, | ||
"Device": "/dev/sdh" | ||
} | ||
}, | ||
"NewVolume": { | ||
"Type": "AWS::EC2::Volume", | ||
"Condition": "CreateProdResources", | ||
"Properties": { | ||
"Size": "8", | ||
"AvailabilityZone": { | ||
"Fn::GetAtt": [ | ||
"MyInstance", | ||
"AvailabilityZone" | ||
] | ||
} | ||
} | ||
} | ||
}, | ||
"Conditions": { | ||
"CreateProdResources": { | ||
"Fn::Equals": [ | ||
{ | ||
"Ref": "EnvType" | ||
}, | ||
"prod" | ||
] | ||
} | ||
}, | ||
"Parameters": { | ||
"EnvType": { | ||
"Type": "String", | ||
"AllowedValues": [ | ||
"prod", | ||
"test" | ||
], | ||
"Default": "test" | ||
}, | ||
"KeyName": { | ||
"Description": "Existing KeyPair", | ||
"Type": "AWS::EC2::KeyPair::KeyName", | ||
"ConstraintDescription": "Must be an existing key pair" | ||
}, | ||
"InstanceType": { | ||
"Description": "Instance Type", | ||
"Type": "String", | ||
"Default": "t2.micro", | ||
"AllowedValues": [ | ||
"t1.micro", | ||
"t2.nano", | ||
"t2.micro", | ||
"t2.small", | ||
"t2.medium", | ||
"t2.large" | ||
], | ||
"ConstraintDescription": "valid instance type" | ||
} | ||
} | ||
} |
123 changes: 123 additions & 0 deletions
123
single-instance-with-parameters-mappings-and-output.template.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
{ | ||
"AWSTemplateFormatVersion": "2010-09-09", | ||
"Description": "Launch single EC2 Instance", | ||
"Resources": { | ||
"MyInstance": { | ||
"Type": "AWS::EC2::Instance", | ||
"Properties": { | ||
"AvailabilityZone": "us-east-1a", | ||
"InstanceType": {"Ref": "InstanceType"}, | ||
"ImageId": { | ||
"Fn::FindInMap": [ | ||
"AWSRegionArch2AMI", | ||
{ | ||
"Ref": "AWS::Region" | ||
}, | ||
{ | ||
"Fn::FindInMap": [ | ||
"AWSInstanceType2Arch", | ||
{ | ||
"Ref": "InstanceType" | ||
}, | ||
"Arch" | ||
] | ||
} | ||
] | ||
}, | ||
"SecurityGroups": [ | ||
{ | ||
"Ref": "MySG" | ||
} | ||
], | ||
"KeyName": {"Ref": "KeyName"}, | ||
"Tags": [ | ||
{ | ||
"Key": "Name", | ||
"Value": "Test Instance" | ||
} | ||
] | ||
} | ||
}, | ||
"MySG": { | ||
"Type": "AWS::EC2::SecurityGroup", | ||
"Properties": { | ||
"GroupDescription": "Enable HTTP & SSH access", | ||
"SecurityGroupIngress": [ | ||
{ | ||
"IpProtocol": "tcp", | ||
"FromPort": "22", | ||
"ToPort": "22", | ||
"CidrIp": "0.0.0.0/0" | ||
}, | ||
{ | ||
"IpProtocol": "tcp", | ||
"FromPort": "80", | ||
"ToPort": "80", | ||
"CidrIp": "0.0.0.0/0" | ||
} | ||
] | ||
} | ||
} | ||
}, | ||
"Mappings" : { | ||
"AWSInstanceType2Arch" : { | ||
"t2.micro" : { "Arch" : "64" }, | ||
"m1.small" : { "Arch" : "32" }, | ||
"m1.large" : { "Arch" : "64" }, | ||
"m1.xlarge" : { "Arch" : "64" }, | ||
"m2.xlarge" : { "Arch" : "64" }, | ||
"m2.2xlarge" : { "Arch" : "64" }, | ||
"m2.4xlarge" : { "Arch" : "64" }, | ||
"c1.medium" : { "Arch" : "32" }, | ||
"c1.xlarge" : { "Arch" : "64" }, | ||
"cc1.4xlarge" : { "Arch" : "64" } | ||
}, | ||
"AWSRegionArch2AMI" : { | ||
"us-east-1" : { "32" : "ami-6411e20d", "64" : "ami-0baf67670ca0f3719" }, | ||
"us-west-1" : { "32" : "ami-c9c7978c", "64" : "ami-cfc7978a" }, | ||
"eu-west-1" : { "32" : "ami-37c2f643", "64" : "ami-31c2f645" }, | ||
"ap-southeast-1" : { "32" : "ami-66f28c34", "64" : "ami-60f28c32" }, | ||
"ap-northeast-1" : { "32" : "ami-9c03a89d", "64" : "ami-a003a8a1" } | ||
} | ||
}, | ||
"Parameters": { | ||
"KeyName": { | ||
"Description": "Existing KeyPair", | ||
"Type": "AWS::EC2::KeyPair::KeyName", | ||
"ConstraintDescription": "Must be an existing key pair" | ||
}, | ||
"InstanceType": { | ||
"Description": "Instance Type", | ||
"Type": "String", | ||
"Default": "t2.micro", | ||
"AllowedValues": [ | ||
"t1.micro", | ||
"t2.nano", | ||
"t2.micro", | ||
"t2.small", | ||
"t2.medium", | ||
"t2.large" | ||
], | ||
"ConstraintDescription": "valid instance type" | ||
} | ||
}, | ||
"Outputs": { | ||
"WebSiteUrl": { | ||
"Description": "URL for the new instance", | ||
"Value": { | ||
"Fn::Join": [ | ||
"", | ||
[ | ||
"http://", | ||
{ | ||
"Fn::GetAtt": [ | ||
"MyInstance", | ||
"PublicDnsName" | ||
] | ||
} | ||
] | ||
] | ||
} | ||
} | ||
} | ||
} |
Oops, something went wrong.