Skip to content

Commit 38bc326

Browse files
committed
first commit
0 parents  commit 38bc326

File tree

156 files changed

+27956
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

156 files changed

+27956
-0
lines changed

AWSCloudFormer.template

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
{
2+
"AWSTemplateFormatVersion" : "2010-09-09",
3+
4+
"Description" : "AWS CloudFormer Beta - template creation prototype application. This tool allows you to create an AWS CloudFormation template from the AWS resources in your AWS account. **Warning** This template creates a single t1.micro instance in your account to run the application - you will be billed for the instance at normal AWS EC2 rates for the t1.micro.",
5+
6+
"Parameters" : {
7+
"AccessControl" : {
8+
"Description" : " The IP address range that can be used to access the CloudFormer tool. NOTE: We highly recommend that you specify a customized address range to lock down the tool.",
9+
"Type": "String",
10+
"MinLength": "9",
11+
"MaxLength": "18",
12+
"Default": "0.0.0.0/0",
13+
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
14+
"ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
15+
}
16+
},
17+
18+
"Mappings" : {
19+
"RegionMap" : {
20+
"us-east-1" : { "AMI" : "ami-21341f48" },
21+
"us-west-2" : { "AMI" : "ami-d6096ee6" },
22+
"us-west-1" : { "AMI" : "ami-ec7c4fa9" },
23+
"eu-west-1" : { "AMI" : "ami-26688051" },
24+
"ap-southeast-1" : { "AMI" : "ami-c0356292" },
25+
"ap-northeast-1" : { "AMI" : "ami-7d1a777c" },
26+
"ap-southeast-2" : { "AMI" : "ami-cd1b84f7" },
27+
"sa-east-1" : { "AMI" : "ami-592d8c44" },
28+
"us-gov-west-1" : { "AMI" : "ami-23c1a500" }
29+
}
30+
},
31+
32+
"Resources" : {
33+
34+
"CFNRole": {
35+
"Type": "AWS::IAM::Role",
36+
"Properties": {
37+
"AssumeRolePolicyDocument": {
38+
"Statement": [{
39+
"Effect": "Allow",
40+
"Principal": { "Service": [ "ec2.amazonaws.com" ] },
41+
"Action": [ "sts:AssumeRole" ]
42+
}]
43+
},
44+
"Path": "/"
45+
}
46+
},
47+
48+
"CFNRolePolicy": {
49+
"Type": "AWS::IAM::Policy",
50+
"Properties": {
51+
"PolicyName": "CloudFormerPolicy",
52+
"PolicyDocument": {
53+
"Statement": [ {
54+
"Effect": "Allow",
55+
"Action" : [
56+
"autoscaling:Describe*",
57+
"cloudfront:List*",
58+
"cloudwatch:Describe*",
59+
"dynamodb:List*", "dynamodb:Describe*",
60+
"ec2:Describe*",
61+
"elasticloadbalancing:Describe*",
62+
"elasticache:Describe*",
63+
"rds:Describe*", "rds:List*",
64+
"route53:List*",
65+
"s3:List*", "s3:Get*", "s3:PutObject",
66+
"sdb:Get*", "sdb:List*",
67+
"sns:Get*", "sns:List*",
68+
"sqs:Get*", "sqs:List*"
69+
],
70+
"Resource": "*"
71+
} ]
72+
},
73+
"Roles": [ { "Ref": "CFNRole" } ]
74+
}
75+
},
76+
77+
"CFNInstanceProfile": {
78+
"Type": "AWS::IAM::InstanceProfile",
79+
"Properties": {
80+
"Path": "/",
81+
"Roles": [ { "Ref": "CFNRole" } ]
82+
}
83+
},
84+
85+
"WebServer" : {
86+
"Type" : "AWS::EC2::Instance",
87+
"Properties" : {
88+
"InstanceType" : "t1.micro",
89+
"SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ],
90+
"ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]},
91+
"IamInstanceProfile" : { "Ref" : "CFNInstanceProfile" }
92+
}
93+
},
94+
95+
"InstanceSecurityGroup" : {
96+
"Type" : "AWS::EC2::SecurityGroup",
97+
"Properties" : {
98+
"GroupDescription" : "Enable Access via port 80",
99+
"SecurityGroupIngress" : [
100+
{ "IpProtocol" : "tcp", "FromPort" : "80", "ToPort" : "80", "CidrIp" : {"Ref" : "AccessControl"}}
101+
]
102+
}
103+
}
104+
},
105+
106+
"Outputs" : {
107+
"URL" : {
108+
"Description" : "AWS CloudFormer Prototype URL. Use this endpoint to create templates from your account.",
109+
"Value" : { "Fn::Join" : ["", [ "http://", { "Fn::GetAtt" : [ "WebServer", "PublicDnsName" ] } ]]}
110+
}
111+
}
112+
}

AutoScalingKeepAtNSample.template

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
{
2+
"AWSTemplateFormatVersion" : "2010-09-09",
3+
4+
"Description" : "AWS CloudFormation Sample Template AutoScalingKeepAtNSample: Create a load balanced, Auto Scaled sample website. This example creates an Auto Scaling group behind a load balancer with a simple health check using a basic getting start AMI that has a simple Apache Web Server-based PHP page. The web site is available on port 80, however, the instances can be configured to listen on any port (8888 by default). **WARNING** This template creates one or more Amazon EC2 instances and an Elastic Load Balancer. You will be billed for the AWS resources used if you create a stack from this template.",
5+
6+
"Parameters" : {
7+
"InstanceType" : {
8+
"Description" : "WebServer EC2 instance type",
9+
"Type" : "String",
10+
"Default" : "m1.small",
11+
"AllowedValues" : [ "t1.micro","m1.small","m1.medium","m1.large","m1.xlarge","m2.xlarge","m2.2xlarge","m2.4xlarge","m3.xlarge","m3.2xlarge","c1.medium","c1.xlarge","cc1.4xlarge","cc2.8xlarge","cg1.4xlarge"],
12+
"ConstraintDescription" : "must be a valid EC2 instance type."
13+
},
14+
15+
"WebServerPort" : {
16+
"Description" : "TCP/IP port of the web server",
17+
"Type" : "String",
18+
"Default" : "8888"
19+
},
20+
"KeyName" : {
21+
"Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances",
22+
"Type" : "String"
23+
},
24+
"SSHLocation" : {
25+
"Description" : "The IP address range that can be used to SSH to the EC2 instances",
26+
"Type": "String",
27+
"MinLength": "9",
28+
"MaxLength": "18",
29+
"Default": "0.0.0.0/0",
30+
"AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})",
31+
"ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x."
32+
}
33+
34+
},
35+
36+
"Mappings" : {
37+
"AWSInstanceType2Arch" : {
38+
"t1.micro" : { "Arch" : "64" },
39+
"m1.small" : { "Arch" : "64" },
40+
"m1.medium" : { "Arch" : "64" },
41+
"m1.large" : { "Arch" : "64" },
42+
"m1.xlarge" : { "Arch" : "64" },
43+
"m2.xlarge" : { "Arch" : "64" },
44+
"m2.2xlarge" : { "Arch" : "64" },
45+
"m2.4xlarge" : { "Arch" : "64" },
46+
"m3.xlarge" : { "Arch" : "64" },
47+
"m3.2xlarge" : { "Arch" : "64" },
48+
"c1.medium" : { "Arch" : "64" },
49+
"c1.xlarge" : { "Arch" : "64" }
50+
},
51+
52+
"AWSRegionArch2AMI" : {
53+
"us-east-1" : { "32" : "ami-aba768c2", "64" : "ami-81a768e8" },
54+
"us-west-1" : { "32" : "ami-458fd300", "64" : "ami-b18ed2f4" },
55+
"us-west-2" : { "32" : "ami-fcff72cc", "64" : "ami-feff72ce" },
56+
"eu-west-1" : { "32" : "ami-018bb975", "64" : "ami-998bb9ed" },
57+
"sa-east-1" : { "32" : "ami-a039e6bd", "64" : "ami-a239e6bf" },
58+
"ap-southeast-1" : { "32" : "ami-425a2010", "64" : "ami-5e5a200c" },
59+
"ap-southeast-2" : { "32" : "ami-b3990e89", "64" : "ami-bd990e87" },
60+
"ap-northeast-1" : { "32" : "ami-7871c579", "64" : "ami-7671c577" }
61+
}
62+
},
63+
64+
"Resources" : {
65+
"WebServerGroup" : {
66+
"Type" : "AWS::AutoScaling::AutoScalingGroup",
67+
"Properties" : {
68+
"AvailabilityZones" : { "Fn::GetAZs" : "" },
69+
"LaunchConfigurationName" : { "Ref" : "LaunchConfig" },
70+
"MinSize" : "2",
71+
"MaxSize" : "2",
72+
"LoadBalancerNames" : [ { "Ref" : "ElasticLoadBalancer" } ]
73+
}
74+
},
75+
76+
"LaunchConfig" : {
77+
"Type" : "AWS::AutoScaling::LaunchConfiguration",
78+
"Properties" : {
79+
"KeyName" : { "Ref" : "KeyName" },
80+
"ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" },
81+
{ "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" },
82+
"Arch" ] } ] },
83+
"UserData" : { "Fn::Base64" : { "Ref" : "WebServerPort" }},
84+
"SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ],
85+
"InstanceType" : { "Ref" : "InstanceType" }
86+
}
87+
},
88+
89+
"ElasticLoadBalancer" : {
90+
"Type" : "AWS::ElasticLoadBalancing::LoadBalancer",
91+
"Properties" : {
92+
"AvailabilityZones" : { "Fn::GetAZs" : "" },
93+
"Listeners" : [ {
94+
"LoadBalancerPort" : "80",
95+
"InstancePort" : { "Ref" : "WebServerPort" },
96+
"Protocol" : "HTTP"
97+
} ],
98+
"HealthCheck" : {
99+
"Target" : { "Fn::Join" : [ "", ["HTTP:", { "Ref" : "WebServerPort" }, "/"]]},
100+
"HealthyThreshold" : "3",
101+
"UnhealthyThreshold" : "5",
102+
"Interval" : "30",
103+
"Timeout" : "5"
104+
}
105+
}
106+
},
107+
108+
"InstanceSecurityGroup" : {
109+
"Type" : "AWS::EC2::SecurityGroup",
110+
"Properties" : {
111+
"GroupDescription" : "Enable SSH access and HTTP access on the configured port",
112+
"SecurityGroupIngress" :
113+
[ { "IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation"} },
114+
{ "IpProtocol" : "tcp", "FromPort" : { "Ref" : "WebServerPort" }, "ToPort" : { "Ref" : "WebServerPort" }, "CidrIp" : "0.0.0.0/0"} ]
115+
}
116+
}
117+
},
118+
119+
"Outputs" : {
120+
"URL" : {
121+
"Description" : "URL of the website",
122+
"Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "ElasticLoadBalancer", "DNSName" ]}]]}
123+
}
124+
}
125+
}

0 commit comments

Comments
 (0)