├── AWSCloudFormer.template ├── AutoScalingKeepAtNSample.template ├── AutoScalingMultiAZSample.template ├── AutoScalingMultiAZWithNotifications.template ├── AutoScalingRollingUpdates.template ├── CloudFrontMultiOriginWithBeanstalkApp.template ├── CloudFront_MultiOrigin.template ├── CloudFront_S3.template ├── Drupal_Multi_AZ.template ├── Drupal_Simple.template ├── Drupal_Single_Instance.template ├── Drupal_Single_Instance_With_RDS.template ├── DynamoDB_Table.template ├── EBS_Snapshot_On_Delete.template ├── EC2ChooseAMI.template ├── EC2InstanceSample.template ├── EC2InstanceWithEBSVolumeConditionalIOPs.template ├── EC2InstanceWithSecurityGroupSample.template ├── EC2WebSiteSample.template ├── EC2WithEBSPIOPs.template ├── EC2WithEBSSample.template ├── EC2WithMetadata.template ├── EC2_Instance_With_Block_Device_Mapping.template ├── EC2_Instance_With_Ephemeral_Drives.template ├── EC2_Untargeted_Launch_with_EBS_Volume.template ├── EIP_With_Association.template ├── ELBSample.template ├── ELBStickinessSample.template ├── ELBWithLockedDownAutoScaledInstances.template ├── ELBWithLockedDownEC2Instances.template ├── ELBZoneApex.template ├── ElastiCache.template ├── ElastiCache_Redis.template ├── Elastic-Beanstalk-in-VPC.template ├── ElasticBeanstalk.template ├── ElasticBeanstalkSample.template ├── ElasticBeanstalkSampleWithRoute53.template ├── ElasticBeanstalk_Nodejs_Sample.template ├── ElasticBeanstalk_PHP_Sample.template ├── ElasticBeanstalk_Ruby_Sample.template ├── ElasticBeanstalk_Simple.template ├── ElasticBeanstalk_Windows_Sample.template ├── Gollum_Simple.template ├── Gollum_Single_Instance.template ├── Gollum_Single_Instance_With_EBS_Volume.template ├── IAM_Policies_SNS_Publish_To_SQS.template ├── IAM_Policies_for_S3.template ├── IAM_Users_Groups_and_Policies.template ├── Insoshi_Multi_AZ.template ├── Insoshi_Simple.template ├── Insoshi_Single_Instance.template ├── Insoshi_Single_Instance_With_RDS.template ├── Joomla!_Multi_AZ.template ├── Joomla!_Simple.template ├── Joomla!_Single_Instance.template ├── Joomla!_Single_Instance_With_RDS.template ├── LAMP_Multi_AZ.template ├── LAMP_Simple.template ├── LAMP_Single_Instance.template ├── LAMP_Single_Instance_With_RDS.template ├── MineCraft_Server.template ├── MonitorEC2AndEBS.template ├── Mutually_Referencing_EC2_Security_Groups.template ├── Parameter_Validate.template ├── RDSDatabaseWithOptionalReadReplica.template ├── RDS_MySQL_55.template ├── RDS_MySQL_55_With_Tags.template ├── RDS_Oracle.template ├── RDS_PIOPS.template ├── RDS_Snapshot_On_Delete.template ├── RDS_VPC.template ├── RDS_Version.template ├── RDS_with_DBParameterGroup.template ├── Rails_Multi_AZ.template ├── Rails_Simple.template ├── Rails_Single_Instance.template ├── Rails_Single_Instance_With_RDS.template ├── Redmine_Multi_AZ.template ├── Redmine_Simple.template ├── Redmine_Single_Instance.template ├── Redmine_Single_Instance_With_RDS.template ├── Route53_A.template ├── Route53_CNAME.template ├── Route53_RoundRobin.template ├── S3Bucket_Auth_1.template ├── S3Bucket_Auth_2.template ├── S3Bucket_Lockdown_to_IAM_User.template ├── S3Bucket_SourceAuth.template ├── S3_Bucket.template ├── S3_Bucket_With_Tags.template ├── S3_Website_Bucket_With_Retain_On_Delete.template ├── S3_Website_With_CloudFront_Distribution.template ├── S3_With_CloudFront_Distribution.template ├── SNSToSQS.template ├── SQS.template ├── SQSWithQueueName.template ├── SQS_Sample_Base_Producer_Consumer.template ├── SQS_Sample_Base_Producer_Consumer_x2.template ├── SQS_Sample_Batch_Producer_Consumer.template ├── SQS_With_CloudWatch_Alarms.template ├── SampleRailsApp.template ├── Templates_within_Templates.template ├── Tracks_Multi_AZ.template ├── Tracks_Simple.template ├── Tracks_Single_Instance.template ├── Tracks_Single_Instance_With_RDS.template ├── UpdateTutorial Part1.template ├── UpdateTutorial Part2.template ├── UpdateTutorial Part3.template ├── UpdateTutorial Part4.template ├── UpdateTutorial Part5.template ├── UpdateTutorialPart1.template ├── UpdateTutorialPart2.template ├── UpdateTutorialPart3.template ├── UpdateTutorialPart4.template ├── UpdateTutorialPart5.template ├── VPC_AutoScaling_and_ElasticLoadBalancer.template ├── VPC_EC2_Instance_With_Multiple_Dynamic_IPAddresses.template ├── VPC_EC2_Instance_With_Multiple_Static_IPAddresses.template ├── VPC_EC2_Instance_with_EIP_and_Security_Group.template ├── VPC_ElastiCache_Cluster.template ├── VPC_Instance_With_Association.template ├── VPC_RDS_DB_Instance.template ├── VPC_With_PublicIPs_And_DNS.template ├── VPC_With_VPN_Connection.template ├── VPC_WordPress_Single_Instance_With_RDS.template ├── WaitObject.template ├── Windows_Roles_And_Features.template ├── Windows_Single_Server_Active_Directory.template ├── Windows_Single_Server_SharePoint_Foundation.template ├── WordPress_Multi_AZ.template ├── WordPress_Simple.template ├── WordPress_Single_Instance.template ├── WordPress_Single_Instance_With_RDS.template ├── auto_scaling_with_instance_profile.template ├── bees-with-machineguns.template ├── cc1-cluster.json ├── cc2-cluster.json ├── cc2-spot-cluster.template ├── chef-server-ubuntu-configuration.template ├── chef-solo-configuration.template ├── ec2_instance_with_instance_profile.template ├── multi-tier-vpc.template ├── multi-tier-web-app-in-vpc.template ├── puppet-client-configuration.template ├── puppet-master-configuration.template ├── sns_httpendpoint.template ├── vpc_multiple_subnets.template ├── vpc_single_instance_in_subnet.template ├── wordpress-via-cfn-bootstrap.template ├── wordpress-via-chef-client.template ├── wordpress-via-chef-solo-building-block.template ├── wordpress-via-chef-solo.template ├── wordpress-via-puppet-client-building-block.template ├── wordpress-via-puppet-client.template └── worker-role.template /AWSCloudFormer.template: -------------------------------------------------------------------------------- 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 | } 113 | -------------------------------------------------------------------------------- /AutoScalingKeepAtNSample.template: -------------------------------------------------------------------------------- 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 | } 126 | -------------------------------------------------------------------------------- /CloudFrontMultiOriginWithBeanstalkApp.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | "Description" : "A sample template to create a CloudFront distribution with multiple origins (2 origins) --- 1) a custom origin - Sample PHP application created using Elastic Beanstalk, 2) a s3 origin - S3 bucket to store image files in jpeg format. **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.", 4 | "Parameters" : { 5 | "KeyName" : { 6 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the AWS Elastic Beanstalk instance", 7 | "Type" : "String" 8 | } 9 | }, 10 | 11 | "Resources" : { 12 | "sampleS3OriginBucket" : { 13 | "Type" : "AWS::S3::Bucket", 14 | "Properties" : { 15 | "AccessControl" : "PublicRead" 16 | } 17 | }, 18 | 19 | "sampleApplication" : { 20 | "Type" : "AWS::ElasticBeanstalk::Application", 21 | "Properties" : { 22 | "Description" : "AWS Elastic Beanstalk PHP Sample Application", 23 | "ApplicationVersions" : [{ 24 | "VersionLabel" : "Initial Version", 25 | "Description" : "Version 1.0", 26 | "SourceBundle" : { 27 | "S3Bucket" : { "Fn::Join" : ["-", ["elasticbeanstalk-samples", { "Ref" : "AWS::Region" }]]}, 28 | "S3Key" : "php-sample.zip" 29 | } 30 | }], 31 | "ConfigurationTemplates" : [{ 32 | "TemplateName" : "DefaultConfiguration", 33 | "Description" : "Default Configuration Version 1.0 - with SSH access", 34 | "SolutionStackName" : "64bit Amazon Linux running PHP 5.3", 35 | "OptionSettings" : [{ 36 | "Namespace" : "aws:autoscaling:launchconfiguration", 37 | "OptionName" : "EC2KeyName", 38 | "Value" : { "Ref" : "KeyName" } 39 | }] 40 | }] 41 | } 42 | }, 43 | 44 | "sampleEnvironment" : { 45 | "Type" : "AWS::ElasticBeanstalk::Environment", 46 | "Properties" : { 47 | "ApplicationName" : { "Ref" : "sampleApplication" }, 48 | "Description" : "AWS Elastic Beanstalk Environment running PHP Sample Application", 49 | "TemplateName" : "DefaultConfiguration", 50 | "VersionLabel" : "Initial Version" 51 | } 52 | }, 53 | 54 | "sampleS3LoggingBucket" : { 55 | "Type" : "AWS::S3::Bucket", 56 | "Properties" : { 57 | "AccessControl" : "PublicRead" 58 | } 59 | }, 60 | 61 | "sampleDistribution" : { 62 | "Type" : "AWS::CloudFront::Distribution", 63 | "Properties" : { 64 | "DistributionConfig" : { 65 | "DefaultRootObject" : "index.php", 66 | "Origins" : [ { 67 | "Id" : "S3 Origin", 68 | "DomainName" : { "Fn::GetAtt" : [ "sampleS3OriginBucket", "DomainName" ] }, 69 | "S3OriginConfig" : {} 70 | }, { 71 | "Id" : "Custom Origin", 72 | "DomainName" : { "Fn::GetAtt" : [ "sampleEnvironment", "EndpointURL" ] }, 73 | "CustomOriginConfig" : { 74 | "OriginProtocolPolicy" : "match-viewer" 75 | } 76 | } 77 | ], 78 | "DefaultCacheBehavior" : { 79 | "TargetOriginId" : "Custom Origin", 80 | "ForwardedValues" : { 81 | "QueryString" : "true" 82 | }, 83 | "ViewerProtocolPolicy" : "allow-all" 84 | }, 85 | "CacheBehaviors" : [ { 86 | "TargetOriginId" : "S3 Origin", 87 | "ForwardedValues" : { 88 | "QueryString" : "false" 89 | }, 90 | "ViewerProtocolPolicy" : "allow-all", 91 | "MinTTL" : "500", 92 | "PathPattern" : "*.jpg" 93 | } 94 | ], 95 | "Comment" : "Sample multi-origin CloudFront distribution created using CloudFormation.", 96 | "Logging" : { 97 | "Bucket" : { "Fn::GetAtt" : [ "sampleS3LoggingBucket", "DomainName"] }, 98 | "Prefix" : "CloudFrontDistributionSampleLogs" 99 | }, 100 | "Enabled" : "true" 101 | } 102 | } 103 | } 104 | }, 105 | "Outputs" : { 106 | "DistributionId" : { 107 | "Description" : "CloudFront Distribution Id", 108 | "Value" : { "Ref" : "sampleDistribution" } 109 | }, 110 | "DistributionName" : { 111 | "Description" : "URL to access the CloudFront distribution", 112 | "Value" : { "Fn::Join" : [ "", ["http://", {"Fn::GetAtt" : ["sampleDistribution", "DomainName"]} ]]} 113 | }, 114 | "S3OriginDNSName" : { 115 | "Description" : "DNS Name of the S3 bucket created as a part of this stack, which is treated as an origin to serve .jpg files for the distribution. After the stack has been created, you can upload .jpg files to the S3 bucket, and access them using : /, where is an image file (say Sample.jpg) uploaded to the S3 bucket.", 116 | "Value" : { "Fn::GetAtt" : [ "sampleS3OriginBucket", "DomainName"] } 117 | } 118 | } 119 | } 120 | 121 | -------------------------------------------------------------------------------- /CloudFront_MultiOrigin.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | "Description" : "A sample template to create a CloudFront distribution with multiple origins (2 origins) --- 1) a custom origin - Sample PHP application created using Elastic Beanstalk, 2) a s3 origin - S3 bucket to store image files in jpeg format. **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.", 4 | "Parameters" : { 5 | "KeyName" : { 6 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the AWS Elastic Beanstalk instance", 7 | "Type" : "String" 8 | } 9 | }, 10 | 11 | "Resources" : { 12 | "sampleS3OriginBucket" : { 13 | "Type" : "AWS::S3::Bucket", 14 | "Properties" : { 15 | "AccessControl" : "PublicRead" 16 | } 17 | }, 18 | 19 | "sampleApplication" : { 20 | "Type" : "AWS::ElasticBeanstalk::Application", 21 | "Properties" : { 22 | "Description" : "AWS Elastic Beanstalk PHP Sample Application", 23 | "ApplicationVersions" : [{ 24 | "VersionLabel" : "Initial Version", 25 | "Description" : "Version 1.0", 26 | "SourceBundle" : { 27 | "S3Bucket" : { "Fn::Join" : ["-", ["elasticbeanstalk-samples", { "Ref" : "AWS::Region" }]]}, 28 | "S3Key" : "php-sample.zip" 29 | } 30 | }], 31 | "ConfigurationTemplates" : [{ 32 | "TemplateName" : "DefaultConfiguration", 33 | "Description" : "Default Configuration Version 1.0 - with SSH access", 34 | "SolutionStackName" : "64bit Amazon Linux running PHP 5.3", 35 | "OptionSettings" : [{ 36 | "Namespace" : "aws:autoscaling:launchconfiguration", 37 | "OptionName" : "EC2KeyName", 38 | "Value" : { "Ref" : "KeyName" } 39 | }] 40 | }] 41 | } 42 | }, 43 | 44 | "sampleEnvironment" : { 45 | "Type" : "AWS::ElasticBeanstalk::Environment", 46 | "Properties" : { 47 | "ApplicationName" : { "Ref" : "sampleApplication" }, 48 | "Description" : "AWS Elastic Beanstalk Environment running PHP Sample Application", 49 | "TemplateName" : "DefaultConfiguration", 50 | "VersionLabel" : "Initial Version" 51 | } 52 | }, 53 | 54 | "sampleS3LoggingBucket" : { 55 | "Type" : "AWS::S3::Bucket", 56 | "Properties" : { 57 | "AccessControl" : "PublicRead" 58 | } 59 | }, 60 | 61 | "sampleDistribution" : { 62 | "Type" : "AWS::CloudFront::Distribution", 63 | "Properties" : { 64 | "DistributionConfig" : { 65 | "DefaultRootObject" : "index.php", 66 | "Origins" : [ { 67 | "Id" : "S3 Origin", 68 | "DomainName" : { "Fn::GetAtt" : [ "sampleS3OriginBucket", "DomainName" ] }, 69 | "S3OriginConfig" : {} 70 | }, { 71 | "Id" : "Custom Origin", 72 | "DomainName" : { "Fn::GetAtt" : [ "sampleEnvironment", "EndpointURL" ] }, 73 | "CustomOriginConfig" : { 74 | "OriginProtocolPolicy" : "match-viewer" 75 | } 76 | } 77 | ], 78 | "DefaultCacheBehavior" : { 79 | "TargetOriginId" : "Custom Origin", 80 | "ForwardedValues" : { 81 | "QueryString" : "true" 82 | }, 83 | "ViewerProtocolPolicy" : "allow-all" 84 | }, 85 | "CacheBehaviors" : [ { 86 | "TargetOriginId" : "S3 Origin", 87 | "ForwardedValues" : { 88 | "QueryString" : "false" 89 | }, 90 | "ViewerProtocolPolicy" : "allow-all", 91 | "MinTTL" : "500", 92 | "PathPattern" : "*.jpg" 93 | } 94 | ], 95 | "Comment" : "Sample multi-origin CloudFront distribution created using CloudFormation.", 96 | "Logging" : { 97 | "Bucket" : { "Fn::GetAtt" : [ "sampleS3LoggingBucket", "DomainName"] }, 98 | "Prefix" : "CloudFrontDistributionSampleLogs" 99 | }, 100 | "Enabled" : "true" 101 | } 102 | } 103 | } 104 | }, 105 | "Outputs" : { 106 | "DistributionId" : { 107 | "Description" : "CloudFront Distribution Id", 108 | "Value" : { "Ref" : "sampleDistribution" } 109 | }, 110 | "DistributionName" : { 111 | "Description" : "URL to access the CloudFront distribution", 112 | "Value" : { "Fn::Join" : [ "", ["http://", {"Fn::GetAtt" : ["sampleDistribution", "DomainName"]} ]]} 113 | }, 114 | "S3OriginDNSName" : { 115 | "Description" : "DNS Name of the S3 bucket created as a part of this stack, which is treated as an origin to serve .jpg files for the distribution. After the stack has been created, you can upload .jpg files to the S3 bucket, and access them using : /, where is an image file (say Sample.jpg) uploaded to the S3 bucket.", 116 | "Value" : { "Fn::GetAtt" : [ "sampleS3OriginBucket", "DomainName"] } 117 | } 118 | } 119 | } 120 | 121 | -------------------------------------------------------------------------------- /CloudFront_S3.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template CloudFront_S3: Sample template showing how to create an Amazon CloudFront distribution using an S3 origin. **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.", 5 | 6 | "Parameters" : { 7 | "S3DNSName" : { 8 | "Type" : "String", 9 | "Description" : "The DNS name of an existing S3 bucket to use as the Cloudfront distribution origin" 10 | } 11 | }, 12 | 13 | "Resources" : { 14 | "myDistribution" : { 15 | "Type" : "AWS::CloudFront::Distribution", 16 | "Properties" : { 17 | "DistributionConfig" : { 18 | "S3Origin" : {"DNSName": { "Ref" : "S3DNSName" }}, 19 | "Enabled" : "true" 20 | } 21 | } 22 | } 23 | }, 24 | "Outputs" : { 25 | "DistributionId" : { 26 | "Value" : { "Ref" : "myDistribution" } 27 | }, 28 | "DistributionName" : { 29 | "Value" : { "Fn::Join" : [ "", ["http://", {"Fn::GetAtt" : ["myDistribution", "DomainName"]} ]]} 30 | } 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /DynamoDB_Table.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template: This template demonstrates the creation of a DynamoDB table.", 5 | 6 | "Parameters" : { 7 | "HaskKeyElementName" : { 8 | "Description" : "HashType PrimaryKey Name", 9 | "Type" : "String", 10 | "AllowedPattern" : "[a-zA-Z0-9]*", 11 | "MinLength": "1", 12 | "MaxLength": "2048", 13 | "ConstraintDescription" : "must contain only alphanumberic characters" 14 | }, 15 | "HaskKeyElementType" : { 16 | "Description" : "HashType PrimaryKey Type", 17 | "Type" : "String", 18 | "Default" : "S", 19 | "AllowedPattern" : "[S|N]", 20 | "MinLength": "1", 21 | "MaxLength": "1", 22 | "ConstraintDescription" : "must be either S or N" 23 | }, 24 | "ReadCapacityUnits" : { 25 | "Description" : "Provisioned read throughput", 26 | "Type" : "Number", 27 | "Default" : "5", 28 | "MinValue": "5", 29 | "MaxValue": "10000", 30 | "ConstraintDescription" : "should be between 5 and 10000" 31 | }, 32 | "WriteCapacityUnits" : { 33 | "Description" : "Provisioned write throughput", 34 | "Type" : "Number", 35 | "Default" : "10", 36 | "MinValue": "5", 37 | "MaxValue": "10000", 38 | "ConstraintDescription" : "should be between 5 and 10000" 39 | } 40 | }, 41 | 42 | "Resources" : { 43 | "myDynamoDBTable" : { 44 | "Type" : "AWS::DynamoDB::Table", 45 | "Properties" : { 46 | "KeySchema" : { 47 | "HashKeyElement": { 48 | "AttributeName" : {"Ref" : "HaskKeyElementName"}, 49 | "AttributeType" : {"Ref" : "HaskKeyElementType"} 50 | } 51 | }, 52 | "ProvisionedThroughput" : { 53 | "ReadCapacityUnits" : {"Ref" : "ReadCapacityUnits"}, 54 | "WriteCapacityUnits" : {"Ref" : "WriteCapacityUnits"} 55 | } 56 | } 57 | } 58 | }, 59 | 60 | "Outputs" : { 61 | "TableName" : { 62 | "Value" : {"Ref" : "myDynamoDBTable"}, 63 | "Description" : "Table name of the newly create DynamoDB table" 64 | } 65 | } 66 | 67 | } 68 | 69 | -------------------------------------------------------------------------------- /EBS_Snapshot_On_Delete.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template EBS_Snapshot_On_Delete: Create an Amazon EC2 instance running the Amazon Linux AMI with a new EBS volume attached. The samples shows how to do an untargeted launch and create an EBS volume in the same availability zone as the EC2 instance. The EBS volume is set to create a snaphot on delete to preserve the contents when the stack is deleted. The AMI is chosen based on the region in which the stack is run. **WARNING** This template creates an Amazon EC2 instance and an EBS volume. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "SSHLocation" : { 8 | "Description" : "The IP address range that can be used to SSH to the EC2 instances", 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 | 19 | "Mappings" : { 20 | "RegionMap" : { 21 | "us-east-1" : { "AMI" : "ami-7f418316" }, 22 | "us-west-1" : { "AMI" : "ami-951945d0" }, 23 | "us-west-2" : { "AMI" : "ami-16fd7026" }, 24 | "eu-west-1" : { "AMI" : "ami-24506250" }, 25 | "sa-east-1" : { "AMI" : "ami-3e3be423" }, 26 | "ap-southeast-1" : { "AMI" : "ami-74dda626" }, 27 | "ap-southeast-2" : { "AMI" : "ami-b3990e89" }, 28 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" } 29 | } 30 | }, 31 | 32 | "Resources" : { 33 | "Ec2Instance" : { 34 | "Type" : "AWS::EC2::Instance", 35 | "Properties" : { 36 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 37 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, 38 | "Tags" : [{ 39 | "Key" : "MyTag", 40 | "Value" : "TagValue" 41 | }] 42 | } 43 | }, 44 | 45 | "InstanceSecurityGroup" : { 46 | "Type" : "AWS::EC2::SecurityGroup", 47 | "Properties" : { 48 | "GroupDescription" : "Enable SSH access via port 22", 49 | "SecurityGroupIngress" : [ { 50 | "IpProtocol" : "tcp", 51 | "FromPort" : "22", 52 | "ToPort" : "22", 53 | "CidrIp" : { "Ref" : "SSHLocation"} 54 | } ] 55 | } 56 | }, 57 | 58 | "NewVolume" : { 59 | "Type" : "AWS::EC2::Volume", 60 | "Properties" : { 61 | "Size" : "100", 62 | "AvailabilityZone" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ]}, 63 | "Tags" : [{ 64 | "Key" : "MyTag", 65 | "Value" : "TagValue" 66 | }] 67 | }, 68 | "DeletionPolicy" : "Snapshot" 69 | }, 70 | 71 | "MountPoint" : { 72 | "Type" : "AWS::EC2::VolumeAttachment", 73 | "Properties" : { 74 | "InstanceId" : { "Ref" : "Ec2Instance" }, 75 | "VolumeId" : { "Ref" : "NewVolume" }, 76 | "Device" : "/dev/sdh" 77 | } 78 | } 79 | }, 80 | 81 | "Outputs" : { 82 | "InstanceId" : { 83 | "Description" : "InstanceId of the newly created EC2 instance", 84 | "Value" : { "Ref" : "Ec2Instance" } 85 | }, 86 | "VolumeId" : { 87 | "Description" : "VolumeId of the newly created EBS Volume", 88 | "Value" : { "Ref" : "NewVolume" } 89 | }, 90 | "AvailabilityZone" : { 91 | "Description" : "The Availability Zone in which the newly created EC2 instance was launched", 92 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ] } 93 | } 94 | } 95 | } 96 | 97 | -------------------------------------------------------------------------------- /EC2ChooseAMI.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template EC2ChooseAMI: Example to show how to chose an AMI based on the region and the architecture type. **WARNING** This template creates an Amazon EC2 instance. 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 | "KeyName" : { 16 | "Type" : "String", 17 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the web server" 18 | }, 19 | "SSHLocation" : { 20 | "Description" : "The IP address range that can be used to SSH to the EC2 instances", 21 | "Type": "String", 22 | "MinLength": "9", 23 | "MaxLength": "18", 24 | "Default": "0.0.0.0/0", 25 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 26 | "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x." 27 | } 28 | }, 29 | 30 | "Mappings" : { 31 | "AWSInstanceType2Arch" : { 32 | "t1.micro" : { "Arch" : "64" }, 33 | "m1.small" : { "Arch" : "64" }, 34 | "m1.medium" : { "Arch" : "64" }, 35 | "m1.large" : { "Arch" : "64" }, 36 | "m1.xlarge" : { "Arch" : "64" }, 37 | "m2.xlarge" : { "Arch" : "64" }, 38 | "m2.2xlarge" : { "Arch" : "64" }, 39 | "m2.4xlarge" : { "Arch" : "64" }, 40 | "m3.xlarge" : { "Arch" : "64" }, 41 | "m3.2xlarge" : { "Arch" : "64" }, 42 | "c1.medium" : { "Arch" : "64" }, 43 | "c1.xlarge" : { "Arch" : "64" }, 44 | "cc1.4xlarge" : { "Arch" : "64HVM" }, 45 | "cc2.8xlarge" : { "Arch" : "64HVM" }, 46 | "cg1.4xlarge" : { "Arch" : "64HVM" } 47 | }, 48 | 49 | "AWSRegionArch2AMI" : { 50 | "us-east-1" : { "32" : "ami-31814f58", "64" : "ami-1b814f72", "64HVM" : "ami-0da96764" }, 51 | "us-west-2" : { "32" : "ami-38fe7308", "64" : "ami-30fe7300", "64HVM" : "NOT_YET_SUPPORTED" }, 52 | "us-west-1" : { "32" : "ami-11d68a54", "64" : "ami-1bd68a5e", "64HVM" : "NOT_YET_SUPPORTED" }, 53 | "eu-west-1" : { "32" : "ami-973b06e3", "64" : "ami-953b06e1", "64HVM" : "NOT_YET_SUPPORTED" }, 54 | "ap-southeast-1" : { "32" : "ami-b4b0cae6", "64" : "ami-beb0caec", "64HVM" : "NOT_YET_SUPPORTED" }, 55 | "ap-southeast-2" : { "32" : "ami-b3990e89", "64" : "ami-bd990e87", "64HVM" : "NOT_YET_SUPPORTED" }, 56 | "ap-northeast-1" : { "32" : "ami-0644f007", "64" : "ami-0a44f00b", "64HVM" : "NOT_YET_SUPPORTED" }, 57 | "sa-east-1" : { "32" : "ami-3e3be423", "64" : "ami-3c3be421", "64HVM" : "NOT_YET_SUPPORTED" } 58 | } 59 | }, 60 | 61 | "Resources" : { 62 | "Ec2Instance" : { 63 | "Type" : "AWS::EC2::Instance", 64 | "Properties" : { 65 | "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, 66 | { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] }, 67 | "KeyName" : { "Ref" : "KeyName" }, 68 | "InstanceType" : { "Ref" : "InstanceType" }, 69 | "SecurityGroups" : [{ "Ref" : "Ec2SecurityGroup" }] 70 | } 71 | }, 72 | 73 | "Ec2SecurityGroup" : { 74 | "Type" : "AWS::EC2::SecurityGroup", 75 | "Properties" : { 76 | "GroupDescription" : "HTTP and SSH access", 77 | "SecurityGroupIngress" : [ { 78 | "IpProtocol" : "tcp", 79 | "FromPort" : "22", "ToPort" : "22", 80 | "CidrIp" : { "Ref" : "SSHLocation"} 81 | } ] 82 | } 83 | } 84 | }, 85 | 86 | "Outputs" : { 87 | "Instance" : { 88 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] }, 89 | "Description" : "DNS Name of the newly created EC2 instance" 90 | } 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /EC2InstanceSample.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template EC2InstanceSample: Create an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based on the region in which the stack is run. This example uses the default security group, so to SSH to the new instance using the KeyPair you enter, you will need to have port 22 open in your default security group. **WARNING** This template an Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "KeyName" : { 8 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance", 9 | "Type" : "String" 10 | } 11 | }, 12 | 13 | "Mappings" : { 14 | "RegionMap" : { 15 | "us-east-1" : { "AMI" : "ami-7f418316" }, 16 | "us-west-1" : { "AMI" : "ami-951945d0" }, 17 | "us-west-2" : { "AMI" : "ami-16fd7026" }, 18 | "eu-west-1" : { "AMI" : "ami-24506250" }, 19 | "sa-east-1" : { "AMI" : "ami-3e3be423" }, 20 | "ap-southeast-1" : { "AMI" : "ami-74dda626" }, 21 | "ap-southeast-2" : { "AMI" : "ami-b3990e89" }, 22 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" } 23 | } 24 | }, 25 | 26 | "Resources" : { 27 | "Ec2Instance" : { 28 | "Type" : "AWS::EC2::Instance", 29 | "Properties" : { 30 | "KeyName" : { "Ref" : "KeyName" }, 31 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, 32 | "UserData" : { "Fn::Base64" : "80" } 33 | } 34 | } 35 | }, 36 | 37 | "Outputs" : { 38 | "InstanceId" : { 39 | "Description" : "InstanceId of the newly created EC2 instance", 40 | "Value" : { "Ref" : "Ec2Instance" } 41 | }, 42 | "AZ" : { 43 | "Description" : "Availability Zone of the newly created EC2 instance", 44 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ] } 45 | }, 46 | "PublicIP" : { 47 | "Description" : "Public IP address of the newly created EC2 instance", 48 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicIp" ] } 49 | }, 50 | "PrivateIP" : { 51 | "Description" : "Private IP address of the newly created EC2 instance", 52 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PrivateIp" ] } 53 | }, 54 | "PublicDNS" : { 55 | "Description" : "Public DNSName of the newly created EC2 instance", 56 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] } 57 | }, 58 | "PrivateDNS" : { 59 | "Description" : "Private DNSName of the newly created EC2 instance", 60 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PrivateDnsName" ] } 61 | } 62 | } 63 | } 64 | -------------------------------------------------------------------------------- /EC2InstanceWithSecurityGroupSample.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template EC2InstanceWithSecurityGroupSample: Create an Amazon EC2 instance running the Amazon Linux AMI. The AMI is chosen based on the region in which the stack is run. This example creates an EC2 security group for the instance to give you SSH access. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "KeyName" : { 8 | "Description" : "Name of and existing EC2 KeyPair to enable SSH access to the instance", 9 | "Type" : "String" 10 | }, 11 | "SSHLocation" : { 12 | "Description" : "The IP address range that can be used to SSH to the EC2 instances", 13 | "Type": "String", 14 | "MinLength": "9", 15 | "MaxLength": "18", 16 | "Default": "0.0.0.0/0", 17 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 18 | "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x." 19 | } 20 | }, 21 | 22 | "Mappings" : { 23 | "RegionMap" : { 24 | "us-east-1" : { "AMI" : "ami-7f418316" }, 25 | "us-west-1" : { "AMI" : "ami-951945d0" }, 26 | "us-west-2" : { "AMI" : "ami-16fd7026" }, 27 | "eu-west-1" : { "AMI" : "ami-24506250" }, 28 | "sa-east-1" : { "AMI" : "ami-3e3be423" }, 29 | "ap-southeast-1" : { "AMI" : "ami-74dda626" }, 30 | "ap-southeast-2" : { "AMI" : "ami-b3990e89" }, 31 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" } 32 | } 33 | }, 34 | 35 | "Resources" : { 36 | "Ec2Instance" : { 37 | "Type" : "AWS::EC2::Instance", 38 | "Properties" : { 39 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 40 | "KeyName" : { "Ref" : "KeyName" }, 41 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]} 42 | } 43 | }, 44 | 45 | "InstanceSecurityGroup" : { 46 | "Type" : "AWS::EC2::SecurityGroup", 47 | "Properties" : { 48 | "GroupDescription" : "Enable SSH access via port 22", 49 | "SecurityGroupIngress" : [ { 50 | "IpProtocol" : "tcp", 51 | "FromPort" : "22", 52 | "ToPort" : "22", 53 | "CidrIp" : { "Ref" : "SSHLocation"} 54 | } ] 55 | } 56 | } 57 | }, 58 | 59 | "Outputs" : { 60 | "InstanceId" : { 61 | "Description" : "InstanceId of the newly created EC2 instance", 62 | "Value" : { "Ref" : "Ec2Instance" } 63 | }, 64 | "AZ" : { 65 | "Description" : "Availability Zone of the newly created EC2 instance", 66 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ] } 67 | }, 68 | "PublicDNS" : { 69 | "Description" : "Public DNSName of the newly created EC2 instance", 70 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] } 71 | }, 72 | "PublicIP" : { 73 | "Description" : "Public IP address of the newly created EC2 instance", 74 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicIp" ] } 75 | } 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /EC2WebSiteSample.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template EC2WebSiteSample: Create an Amazon EC2 instance running a simple Apache webserver. The Apache web server is installed on the EC2 instance along with some simple content using the CloudFormation application bootstrap features of the Amazon Linux AMI. This example creates an EC2 security group for the instance to give you SSH access and an Elastic IP to access the instance. **WARNING** This template creates an Amazon EC2 instance. 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 | "KeyName" : { 16 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance", 17 | "Type" : "String" 18 | }, 19 | "SSHLocation" : { 20 | "Description" : "The IP address range that can be used to SSH to the EC2 instances", 21 | "Type": "String", 22 | "MinLength": "9", 23 | "MaxLength": "18", 24 | "Default": "0.0.0.0/0", 25 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 26 | "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x." 27 | } 28 | }, 29 | 30 | "Mappings" : { 31 | "AWSInstanceType2Arch" : { 32 | "t1.micro" : { "Arch" : "64" }, 33 | "m1.small" : { "Arch" : "64" }, 34 | "m1.medium" : { "Arch" : "64" }, 35 | "m1.large" : { "Arch" : "64" }, 36 | "m1.xlarge" : { "Arch" : "64" }, 37 | "m2.xlarge" : { "Arch" : "64" }, 38 | "m2.2xlarge" : { "Arch" : "64" }, 39 | "m2.4xlarge" : { "Arch" : "64" }, 40 | "m3.xlarge" : { "Arch" : "64" }, 41 | "m3.2xlarge" : { "Arch" : "64" }, 42 | "c1.medium" : { "Arch" : "64" }, 43 | "c1.xlarge" : { "Arch" : "64" }, 44 | "cc1.4xlarge" : { "Arch" : "64HVM" }, 45 | "cc2.8xlarge" : { "Arch" : "64HVM" }, 46 | "cg1.4xlarge" : { "Arch" : "64HVM" } 47 | }, 48 | 49 | "AWSRegionArch2AMI" : { 50 | "us-east-1" : { "32" : "ami-31814f58", "64" : "ami-1b814f72", "64HVM" : "ami-0da96764" }, 51 | "us-west-2" : { "32" : "ami-38fe7308", "64" : "ami-30fe7300", "64HVM" : "NOT_YET_SUPPORTED" }, 52 | "us-west-1" : { "32" : "ami-11d68a54", "64" : "ami-1bd68a5e", "64HVM" : "NOT_YET_SUPPORTED" }, 53 | "eu-west-1" : { "32" : "ami-973b06e3", "64" : "ami-953b06e1", "64HVM" : "NOT_YET_SUPPORTED" }, 54 | "ap-southeast-1" : { "32" : "ami-b4b0cae6", "64" : "ami-beb0caec", "64HVM" : "NOT_YET_SUPPORTED" }, 55 | "ap-southeast-2" : { "32" : "ami-b3990e89", "64" : "ami-bd990e87", "64HVM" : "NOT_YET_SUPPORTED" }, 56 | "ap-northeast-1" : { "32" : "ami-0644f007", "64" : "ami-0a44f00b", "64HVM" : "NOT_YET_SUPPORTED" }, 57 | "sa-east-1" : { "32" : "ami-3e3be423", "64" : "ami-3c3be421", "64HVM" : "NOT_YET_SUPPORTED" } 58 | } 59 | }, 60 | 61 | "Resources" : { 62 | 63 | "Ec2Instance" : { 64 | "Type" : "AWS::EC2::Instance", 65 | "Metadata" : { 66 | "AWS::CloudFormation::Init" : { 67 | "config" : { 68 | "packages" : { 69 | "yum" : { 70 | "httpd" : [], 71 | "php" : [] 72 | } 73 | }, 74 | "sources" : { 75 | "/var/www/html" : "https://s3.amazonaws.com/cloudformation-examples/CloudFormationGettingStarted.tar.gz" 76 | }, 77 | "services" : { 78 | "sysvinit" : { 79 | "httpd" : { 80 | "enabled" : "true", 81 | "ensureRunning" : "true" 82 | } 83 | } 84 | } 85 | } 86 | } 87 | }, 88 | 89 | "Properties" : { 90 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 91 | "KeyName" : { "Ref" : "KeyName" }, 92 | "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, 93 | { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, 94 | "Arch" ] } ] }, 95 | "UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [ 96 | "#!/bin/bash\n", 97 | "yum update -y aws-cfn-bootstrap\n", 98 | 99 | "/opt/aws/bin/cfn-init -s ", { "Ref" : "AWS::StackId" }, " -r Ec2Instance ", 100 | " --region ", { "Ref" : "AWS::Region" }, "\n", 101 | "/opt/aws/bin/cfn-signal -e $? '", { "Ref" : "WaitHandle" }, "'\n" 102 | ]]}} 103 | } 104 | }, 105 | 106 | "WaitHandle" : { 107 | "Type" : "AWS::CloudFormation::WaitConditionHandle" 108 | }, 109 | 110 | "WaitCondition" : { 111 | "Type" : "AWS::CloudFormation::WaitCondition", 112 | "DependsOn" : "Ec2Instance", 113 | "Properties" : { 114 | "Handle" : {"Ref" : "WaitHandle"}, 115 | "Timeout" : "300" 116 | } 117 | }, 118 | 119 | "InstanceSecurityGroup" : { 120 | "Type" : "AWS::EC2::SecurityGroup", 121 | "Properties" : { 122 | "GroupDescription" : "Enable SSH access and HTTP access on the inbound port", 123 | "SecurityGroupIngress" : 124 | [{ "IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation"} }, 125 | { "IpProtocol" : "tcp", "FromPort" : "80", "ToPort" : "80", "CidrIp" : "0.0.0.0/0"}] 126 | } 127 | }, 128 | 129 | "EIP" : { 130 | "Type" : "AWS::EC2::EIP", 131 | "Properties" : { 132 | "InstanceId" : { "Ref" : "Ec2Instance" } 133 | } 134 | } 135 | }, 136 | 137 | "Outputs" : { 138 | "InstanceId" : { 139 | "Description" : "InstanceId of the newly created EC2 instance", 140 | "Value" : { "Ref" : "Ec2Instance" } 141 | }, 142 | "AZ" : { 143 | "Description" : "Availability Zone of the newly created EC2 instance", 144 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ] } 145 | }, 146 | "URL" : { 147 | "Description" : "URL of the sample website", 148 | "Value" : { "Fn::Join" : [ "", [ "http://", { "Ref" : "EIP" }]]} 149 | } 150 | } 151 | } 152 | -------------------------------------------------------------------------------- /EC2WithEBSPIOPs.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template EC2WithEBSPIOPs: Create an Amazon EC2 instance running the Amazon Linux AMI with a new EBS volume attached that has provisioned IOPs. The instance and the volume are pinned to the same availability zone. We recommend that you do untargeted launches rather than pinning instances this way.The AMI is chosen based on the region in which the stack is run. **WARNING** This template creates an Amazon EC2 instance and an EBS Volume. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "KeyName" : { 8 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance", 9 | "Type" : "String" 10 | }, 11 | 12 | "SSHFrom" : { 13 | "Description" : "Lockdown SSH access (default can be accessed from anywhere)", 14 | "Type" : "String", 15 | "MinLength": "9", 16 | "MaxLength": "18", 17 | "Default" : "0.0.0.0/0", 18 | "AllowedPattern" : "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 19 | "ConstraintDescription" : "must be a valid CIDR range of the form x.x.x.x/x." 20 | } 21 | }, 22 | 23 | "Mappings" : { 24 | "RegionMap" : { 25 | "us-east-1" : { "AMI" : "ami-aecd60c7" }, 26 | "us-west-2" : { "AMI" : "ami-48da5578" }, 27 | "us-west-1" : { "AMI" : "ami-734c6936" }, 28 | "eu-west-1" : { "AMI" : "ami-6d555119" }, 29 | "ap-southeast-1" : { "AMI" : "ami-3c0b4a6e" }, 30 | "ap-southeast-2" : { "AMI" : "ami-bd990e87" }, 31 | "ap-northeast-1" : { "AMI" : "ami-2819aa29" }, 32 | "sa-east-1" : { "AMI" : "ami-fe36e8e3" } 33 | } 34 | }, 35 | 36 | "Resources" : { 37 | "EC2Instance" : { 38 | "Type" : "AWS::EC2::Instance", 39 | "Properties" : { 40 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 41 | "InstanceType" : "m1.large", 42 | "KeyName" : { "Ref" : "KeyName" }, 43 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, 44 | "EbsOptimized" : "true" 45 | } 46 | }, 47 | 48 | "InstanceSecurityGroup" : { 49 | "Type" : "AWS::EC2::SecurityGroup", 50 | "Properties" : { 51 | "GroupDescription" : "Enable SSH access via port 22", 52 | "SecurityGroupIngress" : [ { 53 | "IpProtocol" : "tcp", 54 | "FromPort" : "22", 55 | "ToPort" : "22", 56 | "CidrIp" : { "Ref" : "SSHFrom" } 57 | } ] 58 | } 59 | }, 60 | 61 | "MountPoint" : { 62 | "Type" : "AWS::EC2::VolumeAttachment", 63 | "Properties" : { 64 | "InstanceId" : { "Ref" : "EC2Instance" }, 65 | "VolumeId" : { "Ref" : "NewVolume" }, 66 | "Device" : "/dev/sdh" 67 | } 68 | }, 69 | 70 | "NewVolume" : { 71 | "Type" : "AWS::EC2::Volume", 72 | "Properties" : { 73 | "Size" : "100", 74 | "VolumeType" : "io1", 75 | "Iops" : "100", 76 | "AvailabilityZone" : { "Fn::GetAtt" : [ "EC2Instance", "AvailabilityZone" ]} 77 | } 78 | } 79 | }, 80 | 81 | "Outputs" : { 82 | "InstanceId" : { 83 | "Description" : "InstanceId of the newly created EC2 instance", 84 | "Value" : { "Ref" : "EC2Instance" } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /EC2WithEBSSample.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template EC2WithEBSSample: Create an Amazon EC2 instance running the Amazon Linux AMI with a new EBS volume attached. The instance and the volume are pinned to the same availability zone. We recommend that you do untargeted launches rather than pinning instances this way.The AMI is chosen based on the region in which the stack is run. **WARNING** This template creates an Amazon EC2 instance and an EBS Volume. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "KeyName" : { 8 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance", 9 | "Type" : "String" 10 | }, 11 | "SSHLocation" : { 12 | "Description" : "The IP address range that can be used to SSH to the EC2 instances", 13 | "Type": "String", 14 | "MinLength": "9", 15 | "MaxLength": "18", 16 | "Default": "0.0.0.0/0", 17 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 18 | "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x." 19 | } 20 | }, 21 | 22 | "Mappings" : { 23 | "RegionMap" : { 24 | "us-east-1" : { "AMI" : "ami-7f418316", "TestAz" : "us-east-1a" }, 25 | "us-west-1" : { "AMI" : "ami-951945d0", "TestAz" : "us-west-1a" }, 26 | "us-west-2" : { "AMI" : "ami-16fd7026", "TestAz" : "us-west-2a" }, 27 | "eu-west-1" : { "AMI" : "ami-24506250", "TestAz" : "eu-west-1a" }, 28 | "sa-east-1" : { "AMI" : "ami-3e3be423", "TestAz" : "sa-east-1a" }, 29 | "ap-southeast-1" : { "AMI" : "ami-74dda626", "TestAz" : "ap-southeast-1a" }, 30 | "ap-southeast-2" : { "AMI" : "ami-b3990e89", "TestAz" : "ap-southeast-2a" }, 31 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd", "TestAz" : "ap-northeast-1a" } 32 | } 33 | }, 34 | 35 | "Resources" : { 36 | "Ec2Instance" : { 37 | "Type" : "AWS::EC2::Instance", 38 | "Properties" : { 39 | "AvailabilityZone" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "TestAz" ]}, 40 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 41 | "KeyName" : { "Ref" : "KeyName" }, 42 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, 43 | "Volumes" : [ 44 | { "VolumeId" : { "Ref" : "NewVolume" }, 45 | "Device" : "/dev/sdk" 46 | } 47 | ] 48 | } 49 | }, 50 | 51 | "InstanceSecurityGroup" : { 52 | "Type" : "AWS::EC2::SecurityGroup", 53 | "Properties" : { 54 | "GroupDescription" : "Enable SSH access via port 22", 55 | "SecurityGroupIngress" : [ { 56 | "IpProtocol" : "tcp", 57 | "FromPort" : "22", 58 | "ToPort" : "22", 59 | "CidrIp" : { "Ref" : "SSHLocation"} 60 | } ] 61 | } 62 | }, 63 | 64 | "NewVolume" : { 65 | "Type" : "AWS::EC2::Volume", 66 | "Properties" : { 67 | "Size" : "100", 68 | "AvailabilityZone" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "TestAz" ]} 69 | } 70 | } 71 | }, 72 | 73 | "Outputs" : { 74 | "InstanceId" : { 75 | "Description" : "InstanceId of the newly created EC2 instance", 76 | "Value" : { "Ref" : "Ec2Instance" } 77 | }, 78 | "PublicIP" : { 79 | "Description" : "Public IP address of the newly created EC2 instance", 80 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicIp" ] } 81 | }, 82 | "PublicDNS" : { 83 | "Description" : "Public DNSName of the newly created EC2 instance", 84 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] } 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /EC2WithMetadata.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template EC2WithMetadata: Create an Amazon EC2 instance running the Amazon Linux AMI. The Amazon EC2 instance has metadata attached, illustrating that meta data can be used to tag and instance with additonal information that can be accessed via the AWS CloudFormation command line or API. This example used the default security group, so to SSH to the new instance you will need to have port 22 open in your default security group. **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Mappings" : { 7 | "RegionMap" : { 8 | "us-east-1" : { "AMI" : "ami-7f418316" }, 9 | "us-west-1" : { "AMI" : "ami-951945d0" }, 10 | "us-west-2" : { "AMI" : "ami-16fd7026" }, 11 | "eu-west-1" : { "AMI" : "ami-24506250" }, 12 | "sa-east-1" : { "AMI" : "ami-3e3be423" }, 13 | "ap-southeast-1" : { "AMI" : "ami-74dda626" }, 14 | "ap-southeast-2" : { "AMI" : "ami-b3990e89" }, 15 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" } 16 | } 17 | }, 18 | 19 | "Resources" : { 20 | "Ec2Instance" : { 21 | "Type" : "AWS::EC2::Instance", 22 | "Metadata" : { 23 | "Comment" : "This metadata is availabile via the cfn-describe-stack-resource command line tool, the DescribeStackResource API call or the cfn-get-metadata helper", 24 | "MyAMI" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, 25 | "MyRegion" : { "Ref" : "AWS::Region" }, 26 | "MyStack" : { "Ref" : "AWS::StackId" } 27 | }, 28 | "Properties" : { 29 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, 30 | "UserData" : { "Fn::Base64" : "80" } 31 | } 32 | } 33 | }, 34 | 35 | "Outputs" : { 36 | "InstanceId" : { 37 | "Description" : "InstanceId of the newly created EC2 instance", 38 | "Value" : { "Ref" : "Ec2Instance" } 39 | }, 40 | "AZ" : { 41 | "Description" : "Availability Zone of the newly created EC2 instance", 42 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ] } 43 | }, 44 | "PublicIP" : { 45 | "Description" : "Public IP address of the newly created EC2 instance", 46 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicIp" ] } 47 | }, 48 | "PrivateIP" : { 49 | "Description" : "Private IP address of the newly created EC2 instance", 50 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PrivateIp" ] } 51 | } 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /EC2_Instance_With_Block_Device_Mapping.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template EC2_Instance_With_Block_Device_Mapping: Example to show how to attach EBS volumes and modify the root device using EC2 block device mappings. **WARNING** This template creates an Amazon EC2 instance. 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","m3.xlarge","m3.2xlarge","m2.xlarge","m2.2xlarge","m2.4xlarge","c1.medium","c1.xlarge","cc1.4xlarge","cc2.8xlarge","cg1.4xlarge","hi1.4xlarge","hs1.8xlarge"], 12 | "ConstraintDescription" : "must be a valid EC2 instance type." 13 | }, 14 | 15 | "KeyName" : { 16 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the web server", 17 | "Type" : "String" 18 | }, 19 | 20 | "SSHFrom": { 21 | "Description": "Lockdown SSH access to the bastion host (default can be accessed from anywhere)", 22 | "Type": "String", 23 | "MinLength": "9", 24 | "MaxLength": "18", 25 | "Default": "0.0.0.0/0", 26 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 27 | "ConstraintDescription": "must be a valid CIDR range of the form x.x.x.x/x." 28 | } 29 | }, 30 | 31 | "Mappings" : { 32 | "AWSInstanceType2Arch" : { 33 | "t1.micro" : { "Arch" : "PV64" }, 34 | 35 | "m1.small" : { "Arch" : "PV64" }, 36 | "m1.medium" : { "Arch" : "PV64" }, 37 | "m1.large" : { "Arch" : "PV64" }, 38 | "m1.xlarge" : { "Arch" : "PV64" }, 39 | 40 | "m3.xlarge" : { "Arch" : "PV64" }, 41 | "m3.2xlarge" : { "Arch" : "PV64" }, 42 | 43 | "m2.xlarge" : { "Arch" : "PV64" }, 44 | "m2.2xlarge" : { "Arch" : "PV64" }, 45 | "m2.4xlarge" : { "Arch" : "PV64" }, 46 | 47 | "c1.medium" : { "Arch" : "PV64" }, 48 | "c1.xlarge" : { "Arch" : "PV64" }, 49 | 50 | "cc1.4xlarge" : { "Arch" : "CLU64" }, 51 | "cc2.8xlarge" : { "Arch" : "CLU64" }, 52 | 53 | "cg1.4xlarge" : { "Arch" : "GPU64" }, 54 | 55 | "hi1.4xlarge" : { "Arch" : "PV64" }, 56 | 57 | "hs1.8xlarge" : { "Arch" : "PV64" } 58 | }, 59 | 60 | "AWSRegionArch2AMI" : { 61 | "us-east-1" : { "PV64" : "ami-1624987f", "CLU64" : "ami-08249861", "GPU64" : "ami-02f54a6b" }, 62 | "us-west-2" : { "PV64" : "ami-2a31bf1a", "CLU64" : "ami-2431bf14", "GPU64" : "NOT_YET_SUPPORTED" }, 63 | "us-west-1" : { "PV64" : "ami-1bf9de5e", "CLU64" : "NOT_YET_SUPPORTED", "GPU64" : "NOT_YET_SUPPORTED" }, 64 | "eu-west-1" : { "PV64" : "ami-c37474b7", "CLU64" : "ami-d97474ad", "GPU64" : "ami-1b02026f" }, 65 | "ap-southeast-1" : { "PV64" : "ami-a6a7e7f4", "CLU64" : "NOT_YET_SUPPORTED", "GPU64" : "NOT_YET_SUPPORTED" }, 66 | "ap-southeast-2" : { "PV64" : "ami-bd990e87", "CLU64" : "NOT_YET_SUPPORTED", "GPU64" : "NOT_YET_SUPPORTED" }, 67 | "ap-northeast-1" : { "PV64" : "ami-4e6cd34f", "CLU64" : "NOT_YET_SUPPORTED", "GPU64" : "NOT_YET_SUPPORTED" }, 68 | "sa-east-1" : { "PV64" : "ami-1e08d103", "CLU64" : "NOT_YET_SUPPORTED", "GPU64" : "NOT_YET_SUPPORTED" } 69 | } 70 | }, 71 | 72 | "Resources" : { 73 | "Ec2Instance" : { 74 | "Type" : "AWS::EC2::Instance", 75 | "Properties" : { 76 | "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, 77 | { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] }, 78 | "KeyName" : { "Ref" : "KeyName" }, 79 | "InstanceType" : { "Ref" : "InstanceType" }, 80 | "SecurityGroups" : [{ "Ref" : "Ec2SecurityGroup" }], 81 | "BlockDeviceMappings" : [ 82 | { 83 | "DeviceName" : "/dev/sda1", 84 | "Ebs" : { "VolumeSize" : "50" } 85 | },{ 86 | "DeviceName" : "/dev/sdm", 87 | "Ebs" : { "VolumeSize" : "100" } 88 | } 89 | ] 90 | } 91 | }, 92 | 93 | "Ec2SecurityGroup" : { 94 | "Type" : "AWS::EC2::SecurityGroup", 95 | "Properties" : { 96 | "GroupDescription" : "HTTP and SSH access", 97 | "SecurityGroupIngress" : [ { 98 | "IpProtocol" : "tcp", 99 | "FromPort" : "22", "ToPort" : "22", 100 | "CidrIp" : { "Ref" : "SSHFrom" } 101 | } ] 102 | } 103 | } 104 | }, 105 | 106 | "Outputs" : { 107 | "Instance" : { 108 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] }, 109 | "Description" : "DNS Name of the newly created EC2 instance" 110 | } 111 | } 112 | } 113 | -------------------------------------------------------------------------------- /EC2_Instance_With_Ephemeral_Drives.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template EC2_Instance_With_Ephemeral_Drives: Example to show how to attach ephemeral drives using EC2 block device mappings. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "KeyName" : { 8 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the web server", 9 | "Type" : "String" 10 | }, 11 | 12 | "SSHFrom": { 13 | "Description": "Lockdown SSH access to the bastion host (default can be accessed from anywhere)", 14 | "Type": "String", 15 | "MinLength": "9", 16 | "MaxLength": "18", 17 | "Default": "0.0.0.0/0", 18 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 19 | "ConstraintDescription": "must be a valid CIDR range of the form x.x.x.x/x." 20 | } 21 | }, 22 | 23 | "Mappings" : { 24 | "AWSRegionArch2AMI" : { 25 | "us-east-1" : { "PV64" : "ami-1624987f" }, 26 | "us-west-2" : { "PV64" : "ami-2a31bf1a" }, 27 | "us-west-1" : { "PV64" : "ami-1bf9de5e" }, 28 | "eu-west-1" : { "PV64" : "ami-c37474b7" }, 29 | "ap-southeast-1" : { "PV64" : "ami-a6a7e7f4" }, 30 | "ap-southeast-2" : { "PV64" : "ami-bd990e87" }, 31 | "ap-northeast-1" : { "PV64" : "ami-4e6cd34f" }, 32 | "sa-east-1" : { "PV64" : "ami-1e08d103" } 33 | } 34 | }, 35 | 36 | "Resources" : { 37 | "Ec2Instance" : { 38 | "Type" : "AWS::EC2::Instance", 39 | "Properties" : { 40 | "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, "PV64" ]}, 41 | "KeyName" : { "Ref" : "KeyName" }, 42 | "InstanceType" : "m1.small", 43 | "SecurityGroups" : [{ "Ref" : "Ec2SecurityGroup" }], 44 | "BlockDeviceMappings" : [ 45 | { 46 | "DeviceName" : "/dev/sdc", 47 | "VirtualName" : "ephemeral0" 48 | } 49 | ] 50 | } 51 | }, 52 | 53 | "Ec2SecurityGroup" : { 54 | "Type" : "AWS::EC2::SecurityGroup", 55 | "Properties" : { 56 | "GroupDescription" : "HTTP and SSH access", 57 | "SecurityGroupIngress" : [ { 58 | "IpProtocol" : "tcp", 59 | "FromPort" : "22", "ToPort" : "22", 60 | "CidrIp" : { "Ref" : "SSHFrom" } 61 | } ] 62 | } 63 | } 64 | }, 65 | 66 | "Outputs" : { 67 | "Instance" : { 68 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] }, 69 | "Description" : "DNS Name of the newly created EC2 instance" 70 | } 71 | } 72 | } 73 | -------------------------------------------------------------------------------- /EC2_Untargeted_Launch_with_EBS_Volume.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template EC2_Untargeted_Launch_with_EBS_Volume: Create an Amazon EC2 instance running the Amazon Linux AMI with a new EBS volume attached. The samples shows how to do an untargeted EC2 launch and create an EBS volume in the same availability zone as the EC2 instance. The AMI is chosen based on the region in which the stack is run. **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "SSHLocation" : { 8 | "Description" : "The IP address range that can be used to SSH to the EC2 instances", 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-7f418316" }, 21 | "us-west-1" : { "AMI" : "ami-951945d0" }, 22 | "us-west-2" : { "AMI" : "ami-16fd7026" }, 23 | "eu-west-1" : { "AMI" : "ami-24506250" }, 24 | "sa-east-1" : { "AMI" : "ami-3e3be423" }, 25 | "ap-southeast-1" : { "AMI" : "ami-74dda626" }, 26 | "ap-southeast-2" : { "AMI" : "ami-b3990e89" }, 27 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" } 28 | } 29 | }, 30 | 31 | "Resources" : { 32 | "Ec2Instance" : { 33 | "Type" : "AWS::EC2::Instance", 34 | "Properties" : { 35 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 36 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, 37 | "Tags" : [{ 38 | "Key" : "MyTag", 39 | "Value" : "TagValue" 40 | }] 41 | } 42 | }, 43 | 44 | "InstanceSecurityGroup" : { 45 | "Type" : "AWS::EC2::SecurityGroup", 46 | "Properties" : { 47 | "GroupDescription" : "Enable SSH access", 48 | "SecurityGroupIngress" : [ { 49 | "IpProtocol" : "tcp", 50 | "FromPort" : "22", 51 | "ToPort" : "22", 52 | "CidrIp" : { "Ref" : "SSHLocation"} 53 | } ] 54 | } 55 | }, 56 | 57 | "NewVolume" : { 58 | "Type" : "AWS::EC2::Volume", 59 | "Properties" : { 60 | "Size" : "100", 61 | "AvailabilityZone" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ]}, 62 | "Tags" : [{ 63 | "Key" : "MyTag", 64 | "Value" : "TagValue" 65 | }] 66 | } 67 | }, 68 | 69 | "MountPoint" : { 70 | "Type" : "AWS::EC2::VolumeAttachment", 71 | "Properties" : { 72 | "InstanceId" : { "Ref" : "Ec2Instance" }, 73 | "VolumeId" : { "Ref" : "NewVolume" }, 74 | "Device" : "/dev/sdh" 75 | } 76 | } 77 | }, 78 | 79 | "Outputs" : { 80 | "InstanceId" : { 81 | "Description" : "InstanceId of the newly created EC2 instance", 82 | "Value" : { "Ref" : "Ec2Instance" } 83 | }, 84 | "VolumeId" : { 85 | "Description" : "VolumeId of the newly created EBS Volume", 86 | "Value" : { "Ref" : "NewVolume" } 87 | }, 88 | "AvailabilityZone" : { 89 | "Description" : "The Availability Zone in which the newly created EC2 instance was launched", 90 | "Value" : { "Fn::GetAtt" : [ "Ec2Instance", "AvailabilityZone" ] } 91 | } 92 | } 93 | } 94 | 95 | -------------------------------------------------------------------------------- /EIP_With_Association.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template Sample template EIP_With_Association: This template shows how to associate an Elastic IP address with an Amazon EC2 instance - you can use this same technique to associate an EC2 instance with an Elastic IP Address that is not created inside the template by replacing the EIP reference in the AWS::EC2::EIPAssoication resource type with the IP address of the external EIP. **WARNING** This template creates an Amazon EC2 instance and an Elastic IP Address. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Mappings" : { 7 | "RegionMap" : { 8 | "us-east-1" : { "AMI" : "ami-7f418316" }, 9 | "us-west-1" : { "AMI" : "ami-951945d0" }, 10 | "us-west-2" : { "AMI" : "ami-16fd7026" }, 11 | "eu-west-1" : { "AMI" : "ami-24506250" }, 12 | "sa-east-1" : { "AMI" : "ami-3e3be423" }, 13 | "ap-southeast-1" : { "AMI" : "ami-74dda626" }, 14 | "ap-southeast-2" : { "AMI" : "ami-b3990e89" }, 15 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" } 16 | } 17 | }, 18 | 19 | "Resources" : { 20 | "Ec2Instance" : { 21 | "Type" : "AWS::EC2::Instance", 22 | "Properties" : { 23 | "UserData" : { "Fn::Base64" : { "Fn::Join" : [ "", [ "IPAddress=", {"Ref" : "IPAddress"}]]}}, 24 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]} 25 | } 26 | }, 27 | 28 | "IPAddress" : { 29 | "Type" : "AWS::EC2::EIP" 30 | }, 31 | 32 | "IPAssoc" : { 33 | "Type" : "AWS::EC2::EIPAssociation", 34 | "Properties" : { 35 | "InstanceId" : { "Ref" : "Ec2Instance" }, 36 | "EIP" : { "Ref" : "IPAddress" } 37 | } 38 | } 39 | }, 40 | "Outputs" : { 41 | "InstanceId" : { 42 | "Value" : { "Ref" : "Ec2Instance" } 43 | }, 44 | "InstanceIPAddress" : { 45 | "Value" : { "Ref" : "IPAddress" } 46 | } 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /ELBSample.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template ELBSample: Create a load balanced sample web site. The AMI is chosen based on the region in which the stack is run. This example creates 2 EC2 instances behind a load balancer with a simple health check. The instances may be created in one or more AZs. 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 | "WebServerPort" : { 15 | "Description" : "TCP/IP port of the web server", 16 | "Type" : "String", 17 | "Default" : "8888" 18 | }, 19 | "KeyName" : { 20 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances", 21 | "Type" : "String" 22 | }, 23 | "SSHLocation" : { 24 | "Description" : "The IP address range that can be used to SSH to the EC2 instances", 25 | "Type": "String", 26 | "MinLength": "9", 27 | "MaxLength": "18", 28 | "Default": "0.0.0.0/0", 29 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 30 | "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x." 31 | } 32 | }, 33 | 34 | "Mappings" : { 35 | "AWSInstanceType2Arch" : { 36 | "t1.micro" : { "Arch" : "64" }, 37 | "m1.small" : { "Arch" : "64" }, 38 | "m1.medium" : { "Arch" : "64" }, 39 | "m1.large" : { "Arch" : "64" }, 40 | "m1.xlarge" : { "Arch" : "64" }, 41 | "m2.xlarge" : { "Arch" : "64" }, 42 | "m2.2xlarge" : { "Arch" : "64" }, 43 | "m3.xlarge" : { "Arch" : "64" }, 44 | "m3.2xlarge" : { "Arch" : "64" }, 45 | "m2.4xlarge" : { "Arch" : "64" }, 46 | "c1.medium" : { "Arch" : "64" }, 47 | "c1.xlarge" : { "Arch" : "64" } 48 | }, 49 | 50 | "AWSRegionArch2AMI" : { 51 | "us-east-1" : { "32" : "ami-aba768c2", "64" : "ami-81a768e8" }, 52 | "us-west-1" : { "32" : "ami-458fd300", "64" : "ami-b18ed2f4" }, 53 | "us-west-2" : { "32" : "ami-fcff72cc", "64" : "ami-feff72ce" }, 54 | "eu-west-1" : { "32" : "ami-018bb975", "64" : "ami-998bb9ed" }, 55 | "sa-east-1" : { "32" : "ami-a039e6bd", "64" : "ami-a239e6bf" }, 56 | "ap-southeast-1" : { "32" : "ami-425a2010", "64" : "ami-5e5a200c" }, 57 | "ap-southeast-2" : { "32" : "ami-f98512c3", "64" : "ami-43851279" }, 58 | "ap-northeast-1" : { "32" : "ami-7871c579", "64" : "ami-7671c577" } 59 | } 60 | }, 61 | 62 | "Resources" : { 63 | "ElasticLoadBalancer" : { 64 | "Type" : "AWS::ElasticLoadBalancing::LoadBalancer", 65 | "Properties" : { 66 | "AvailabilityZones" : { "Fn::GetAZs" : "" }, 67 | "Instances" : [ { "Ref" : "Ec2Instance1" },{ "Ref" : "Ec2Instance2" } ], 68 | "Listeners" : [ { 69 | "LoadBalancerPort" : "80", 70 | "InstancePort" : { "Ref" : "WebServerPort" }, 71 | "Protocol" : "HTTP" 72 | } ], 73 | "HealthCheck" : { 74 | "Target" : { "Fn::Join" : [ "", ["HTTP:", { "Ref" : "WebServerPort" }, "/"]]}, 75 | "HealthyThreshold" : "3", 76 | "UnhealthyThreshold" : "5", 77 | "Interval" : "30", 78 | "Timeout" : "5" 79 | } 80 | } 81 | }, 82 | 83 | "Ec2Instance1" : { 84 | "Type" : "AWS::EC2::Instance", 85 | "Properties" : { 86 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 87 | "KeyName" : { "Ref" : "KeyName" }, 88 | "InstanceType" : { "Ref" : "InstanceType" }, 89 | "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, 90 | { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, 91 | "Arch" ] } ] }, 92 | "UserData" : { "Fn::Base64" : { "Ref" : "WebServerPort" }} 93 | } 94 | }, 95 | 96 | "Ec2Instance2" : { 97 | "Type" : "AWS::EC2::Instance", 98 | "Properties" : { 99 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 100 | "KeyName" : { "Ref" : "KeyName" }, 101 | "InstanceType" : { "Ref" : "InstanceType" }, 102 | "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, 103 | { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, 104 | "Arch" ] } ] }, 105 | "UserData" : { "Fn::Base64" : { "Ref" : "WebServerPort" }} 106 | } 107 | }, 108 | 109 | "InstanceSecurityGroup" : { 110 | "Type" : "AWS::EC2::SecurityGroup", 111 | "Properties" : { 112 | "GroupDescription" : "Enable SSH access and HTTP access on the inbound port", 113 | "SecurityGroupIngress" : [ { 114 | "IpProtocol" : "tcp", 115 | "FromPort" : "22", 116 | "ToPort" : "22", 117 | "CidrIp" : { "Ref" : "SSHLocation"} 118 | }, 119 | { 120 | "IpProtocol" : "tcp", 121 | "FromPort" : { "Ref" : "WebServerPort" }, 122 | "ToPort" : { "Ref" : "WebServerPort" }, 123 | "CidrIp" : "0.0.0.0/0" 124 | } ] 125 | } 126 | } 127 | }, 128 | 129 | "Outputs" : { 130 | "URL" : { 131 | "Description" : "URL of the sample website", 132 | "Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "ElasticLoadBalancer", "DNSName" ]}]]} 133 | } 134 | } 135 | } 136 | -------------------------------------------------------------------------------- /ELBStickinessSample.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template ELBStickinessSample: Create a load balanced sample web site with ELB stickiness enabled. The AMI is chosen based on the region in which the stack is run. This example creates 2 EC2 instances behind a load balancer with a simple health check. The ec2 instnces are untargeted and may be deployed in one or more availaiblity zones. 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 | "WebServerPort" : { 15 | "Description" : "TCP/IP port of the web server", 16 | "Type" : "String", 17 | "Default" : "8888" 18 | }, 19 | "KeyName" : { 20 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instances", 21 | "Type" : "String" 22 | }, 23 | "SSHLocation" : { 24 | "Description" : "The IP address range that can be used to SSH to the EC2 instances", 25 | "Type": "String", 26 | "MinLength": "9", 27 | "MaxLength": "18", 28 | "Default": "0.0.0.0/0", 29 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 30 | "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x." 31 | } 32 | }, 33 | 34 | "Mappings" : { 35 | "AWSInstanceType2Arch" : { 36 | "t1.micro" : { "Arch" : "64" }, 37 | "m1.small" : { "Arch" : "64" }, 38 | "m1.medium" : { "Arch" : "64" }, 39 | "m1.large" : { "Arch" : "64" }, 40 | "m1.xlarge" : { "Arch" : "64" }, 41 | "m2.xlarge" : { "Arch" : "64" }, 42 | "m2.2xlarge" : { "Arch" : "64" }, 43 | "m2.4xlarge" : { "Arch" : "64" }, 44 | "m3.xlarge" : { "Arch" : "64" }, 45 | "m3.2xlarge" : { "Arch" : "64" }, 46 | "c1.medium" : { "Arch" : "64" }, 47 | "c1.xlarge" : { "Arch" : "64" } 48 | }, 49 | 50 | "AWSRegionArch2AMI" : { 51 | "us-east-1" : { "32" : "ami-aba768c2", "64" : "ami-81a768e8" }, 52 | "us-west-1" : { "32" : "ami-458fd300", "64" : "ami-b18ed2f4" }, 53 | "us-west-2" : { "32" : "ami-fcff72cc", "64" : "ami-feff72ce" }, 54 | "eu-west-1" : { "32" : "ami-018bb975", "64" : "ami-998bb9ed" }, 55 | "sa-east-1" : { "32" : "ami-a039e6bd", "64" : "ami-a239e6bf" }, 56 | "ap-southeast-1" : { "32" : "ami-425a2010", "64" : "ami-5e5a200c" }, 57 | "ap-southeast-2" : { "32" : "ami-f98512c3", "64" : "ami-43851279" }, 58 | "ap-northeast-1" : { "32" : "ami-7871c579", "64" : "ami-7671c577" } 59 | } 60 | }, 61 | 62 | "Resources" : { 63 | "ElasticLoadBalancer" : { 64 | "Type" : "AWS::ElasticLoadBalancing::LoadBalancer", 65 | "Properties" : { 66 | "AvailabilityZones" : { "Fn::GetAZs" : "" }, 67 | "Instances" : [ { "Ref" : "Ec2Instance1" },{ "Ref" : "Ec2Instance2" } ], 68 | "LBCookieStickinessPolicy" : [{ 69 | "PolicyName" : "MyLBPolicy", 70 | "CookieExpirationPeriod" : "180" 71 | } ], 72 | "Listeners" : [ { 73 | "LoadBalancerPort" : "80", 74 | "InstancePort" : { "Ref" : "WebServerPort" }, 75 | "Protocol" : "HTTP", 76 | "PolicyNames" : [ "MyLBPolicy" ] 77 | } ], 78 | "HealthCheck" : { 79 | "Target" : { "Fn::Join" : [ "", ["HTTP:", { "Ref" : "WebServerPort" }, "/"]]}, 80 | "HealthyThreshold" : "3", 81 | "UnhealthyThreshold" : "5", 82 | "Interval" : "30", 83 | "Timeout" : "5" 84 | } 85 | } 86 | }, 87 | 88 | "Ec2Instance1" : { 89 | "Type" : "AWS::EC2::Instance", 90 | "Properties" : { 91 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 92 | "KeyName" : { "Ref" : "KeyName" }, 93 | "InstanceType" : { "Ref" : "InstanceType" }, 94 | "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, 95 | { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, 96 | "Arch" ] } ] }, 97 | "UserData" : { "Fn::Base64" : { "Ref" : "WebServerPort" }} 98 | } 99 | }, 100 | 101 | "Ec2Instance2" : { 102 | "Type" : "AWS::EC2::Instance", 103 | "Properties" : { 104 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 105 | "KeyName" : { "Ref" : "KeyName" }, 106 | "InstanceType" : { "Ref" : "InstanceType" }, 107 | "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, 108 | { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, 109 | "Arch" ] } ] }, 110 | "UserData" : { "Fn::Base64" : { "Ref" : "WebServerPort" }} 111 | } 112 | }, 113 | 114 | "InstanceSecurityGroup" : { 115 | "Type" : "AWS::EC2::SecurityGroup", 116 | "Properties" : { 117 | "GroupDescription" : "Enable SSH access and HTTP access on the inbound port", 118 | "SecurityGroupIngress" : [ { 119 | "IpProtocol" : "tcp", 120 | "FromPort" : "22", 121 | "ToPort" : "22", 122 | "CidrIp" : { "Ref" : "SSHLocation"} 123 | }, 124 | { 125 | "IpProtocol" : "tcp", 126 | "FromPort" : { "Ref" : "WebServerPort" }, 127 | "ToPort" : { "Ref" : "WebServerPort" }, 128 | "CidrIp" : "0.0.0.0/0" 129 | } ] 130 | } 131 | } 132 | }, 133 | 134 | "Outputs" : { 135 | "URL" : { 136 | "Description" : "URL of the sample website", 137 | "Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "ElasticLoadBalancer", "DNSName" ]}]]} 138 | } 139 | } 140 | } 141 | -------------------------------------------------------------------------------- /ELBWithLockedDownAutoScaledInstances.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template ELBWithLockedDownAutoScaledInstances: Create a load balanced, Auto Scaled sample website where the instances are locked down to only accept traffic from the load balancer. This example creates an Auto Scaling group behind a load balancer with a simple health check. 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 | }, 21 | 22 | "Mappings" : { 23 | "AWSInstanceType2Arch" : { 24 | "t1.micro" : { "Arch" : "64" }, 25 | "m1.small" : { "Arch" : "64" }, 26 | "m1.medium" : { "Arch" : "64" }, 27 | "m1.large" : { "Arch" : "64" }, 28 | "m1.xlarge" : { "Arch" : "64" }, 29 | "m2.xlarge" : { "Arch" : "64" }, 30 | "m2.2xlarge" : { "Arch" : "64" }, 31 | "m2.4xlarge" : { "Arch" : "64" }, 32 | "m3.xlarge" : { "Arch" : "64" }, 33 | "m3.2xlarge" : { "Arch" : "64" }, 34 | "c1.medium" : { "Arch" : "64" }, 35 | "c1.xlarge" : { "Arch" : "64" } 36 | }, 37 | 38 | "AWSRegionArch2AMI" : { 39 | "us-east-1" : { "32" : "ami-aba768c2", "64" : "ami-81a768e8" }, 40 | "us-west-1" : { "32" : "ami-458fd300", "64" : "ami-b18ed2f4" }, 41 | "us-west-2" : { "32" : "ami-fcff72cc", "64" : "ami-feff72ce" }, 42 | "eu-west-1" : { "32" : "ami-018bb975", "64" : "ami-998bb9ed" }, 43 | "sa-east-1" : { "32" : "ami-a039e6bd", "64" : "ami-a239e6bf" }, 44 | "ap-southeast-1" : { "32" : "ami-425a2010", "64" : "ami-5e5a200c" }, 45 | "ap-southeast-2" : { "32" : "ami-f98512c3", "64" : "ami-43851279" }, 46 | "ap-northeast-1" : { "32" : "ami-7871c579", "64" : "ami-7671c577" } 47 | } 48 | }, 49 | 50 | "Resources" : { 51 | "WebServerGroup" : { 52 | "Type" : "AWS::AutoScaling::AutoScalingGroup", 53 | "Properties" : { 54 | "AvailabilityZones" : { "Fn::GetAZs" : "" }, 55 | "LaunchConfigurationName" : { "Ref" : "LaunchConfig" }, 56 | "MinSize" : "2", 57 | "MaxSize" : "2", 58 | "LoadBalancerNames" : [ { "Ref" : "ElasticLoadBalancer" } ] 59 | } 60 | }, 61 | 62 | "LaunchConfig" : { 63 | "Type" : "AWS::AutoScaling::LaunchConfiguration", 64 | "Properties" : { 65 | "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, 66 | { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, 67 | "Arch" ] } ] }, 68 | "UserData" : { "Fn::Base64" : { "Ref" : "WebServerPort" }}, 69 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 70 | "InstanceType" : { "Ref" : "InstanceType" } 71 | } 72 | }, 73 | 74 | "ElasticLoadBalancer" : { 75 | "Type" : "AWS::ElasticLoadBalancing::LoadBalancer", 76 | "Properties" : { 77 | "AvailabilityZones" : { "Fn::GetAZs" : "" }, 78 | "Listeners" : [ { 79 | "LoadBalancerPort" : "80", 80 | "InstancePort" : { "Ref" : "WebServerPort" }, 81 | "Protocol" : "HTTP" 82 | } ], 83 | "HealthCheck" : { 84 | "Target" : { "Fn::Join" : [ "", ["HTTP:", { "Ref" : "WebServerPort" }, "/"]]}, 85 | "HealthyThreshold" : "3", 86 | "UnhealthyThreshold" : "5", 87 | "Interval" : "30", 88 | "Timeout" : "5" 89 | } 90 | } 91 | }, 92 | 93 | "InstanceSecurityGroup" : { 94 | "Type" : "AWS::EC2::SecurityGroup", 95 | "Properties" : { 96 | "GroupDescription" : "Enable SSH access and HTTP access on the inbound port", 97 | "SecurityGroupIngress" : [ { 98 | "IpProtocol" : "tcp", 99 | "FromPort" : { "Ref" : "WebServerPort" }, 100 | "ToPort" : { "Ref" : "WebServerPort" }, 101 | "SourceSecurityGroupOwnerId" : {"Fn::GetAtt" : ["ElasticLoadBalancer", "SourceSecurityGroup.OwnerAlias"]}, 102 | "SourceSecurityGroupName" : {"Fn::GetAtt" : ["ElasticLoadBalancer", "SourceSecurityGroup.GroupName"]} 103 | } ] 104 | } 105 | } 106 | }, 107 | 108 | "Outputs" : { 109 | "URL" : { 110 | "Description" : "URL of the website", 111 | "Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "ElasticLoadBalancer", "DNSName" ]}]]} 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /ELBWithLockedDownEC2Instances.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template ELBWithLockedDownEC2Instances: Create a load balanced, Auto Scaled sample website where the instances are locked down to only accept traffic from the load balancer. This example creates an Auto Scaling group behind a load balancer with a simple health check. 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 | }, 21 | 22 | "Mappings" : { 23 | "AWSInstanceType2Arch" : { 24 | "t1.micro" : { "Arch" : "64" }, 25 | "m1.small" : { "Arch" : "64" }, 26 | "m1.medium" : { "Arch" : "64" }, 27 | "m1.large" : { "Arch" : "64" }, 28 | "m1.xlarge" : { "Arch" : "64" }, 29 | "m2.xlarge" : { "Arch" : "64" }, 30 | "m2.2xlarge" : { "Arch" : "64" }, 31 | "m2.4xlarge" : { "Arch" : "64" }, 32 | "m3.xlarge" : { "Arch" : "64" }, 33 | "m3.2xlarge" : { "Arch" : "64" }, 34 | "c1.medium" : { "Arch" : "64" }, 35 | "c1.xlarge" : { "Arch" : "64" } 36 | }, 37 | 38 | "AWSRegionArch2AMI" : { 39 | "us-east-1" : { "32" : "ami-aba768c2", "64" : "ami-81a768e8" }, 40 | "us-west-1" : { "32" : "ami-458fd300", "64" : "ami-b18ed2f4" }, 41 | "us-west-2" : { "32" : "ami-fcff72cc", "64" : "ami-feff72ce" }, 42 | "eu-west-1" : { "32" : "ami-018bb975", "64" : "ami-998bb9ed" }, 43 | "sa-east-1" : { "32" : "ami-a039e6bd", "64" : "ami-a239e6bf" }, 44 | "ap-southeast-1" : { "32" : "ami-425a2010", "64" : "ami-5e5a200c" }, 45 | "ap-southeast-2" : { "32" : "ami-f98512c3", "64" : "ami-43851279" }, 46 | "ap-northeast-1" : { "32" : "ami-7871c579", "64" : "ami-7671c577" } 47 | } 48 | }, 49 | 50 | "Resources" : { 51 | "WebServerGroup" : { 52 | "Type" : "AWS::AutoScaling::AutoScalingGroup", 53 | "Properties" : { 54 | "AvailabilityZones" : { "Fn::GetAZs" : "" }, 55 | "LaunchConfigurationName" : { "Ref" : "LaunchConfig" }, 56 | "MinSize" : "2", 57 | "MaxSize" : "2", 58 | "LoadBalancerNames" : [ { "Ref" : "ElasticLoadBalancer" } ] 59 | } 60 | }, 61 | 62 | "LaunchConfig" : { 63 | "Type" : "AWS::AutoScaling::LaunchConfiguration", 64 | "Properties" : { 65 | "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, 66 | { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, 67 | "Arch" ] } ] }, 68 | "UserData" : { "Fn::Base64" : { "Ref" : "WebServerPort" }}, 69 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 70 | "InstanceType" : { "Ref" : "InstanceType" } 71 | } 72 | }, 73 | 74 | "ElasticLoadBalancer" : { 75 | "Type" : "AWS::ElasticLoadBalancing::LoadBalancer", 76 | "Properties" : { 77 | "AvailabilityZones" : { "Fn::GetAZs" : "" }, 78 | "Listeners" : [ { 79 | "LoadBalancerPort" : "80", 80 | "InstancePort" : { "Ref" : "WebServerPort" }, 81 | "Protocol" : "HTTP" 82 | } ], 83 | "HealthCheck" : { 84 | "Target" : { "Fn::Join" : [ "", ["HTTP:", { "Ref" : "WebServerPort" }, "/"]]}, 85 | "HealthyThreshold" : "3", 86 | "UnhealthyThreshold" : "5", 87 | "Interval" : "30", 88 | "Timeout" : "5" 89 | } 90 | } 91 | }, 92 | 93 | "InstanceSecurityGroup" : { 94 | "Type" : "AWS::EC2::SecurityGroup", 95 | "Properties" : { 96 | "GroupDescription" : "Enable SSH access and HTTP access on the inbound port", 97 | "SecurityGroupIngress" : [ { 98 | "IpProtocol" : "tcp", 99 | "FromPort" : { "Ref" : "WebServerPort" }, 100 | "ToPort" : { "Ref" : "WebServerPort" }, 101 | "SourceSecurityGroupOwnerId" : {"Fn::GetAtt" : ["ElasticLoadBalancer", "SourceSecurityGroup.OwnerAlias"]}, 102 | "SourceSecurityGroupName" : {"Fn::GetAtt" : ["ElasticLoadBalancer", "SourceSecurityGroup.GroupName"]} 103 | } ] 104 | } 105 | } 106 | }, 107 | 108 | "Outputs" : { 109 | "URL" : { 110 | "Description" : "URL of the website", 111 | "Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "ElasticLoadBalancer", "DNSName" ]}]]} 112 | } 113 | } 114 | } 115 | -------------------------------------------------------------------------------- /ElasticBeanstalkSample.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template ElasticBeanstalkSample: Configure and launch the AWS Elastic Beanstalk sample application. **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "KeyName" : { 8 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the AWS Elastic Beanstalk instance", 9 | "Type" : "String" 10 | } 11 | }, 12 | 13 | "Resources" : { 14 | "sampleApplication" : { 15 | "Type" : "AWS::ElasticBeanstalk::Application", 16 | "Properties" : { 17 | "Description" : "AWS Elastic Beanstalk Sample Application", 18 | "ApplicationVersions" : [{ 19 | "VersionLabel" : "Initial Version", 20 | "Description" : "Version 1.0", 21 | "SourceBundle" : { 22 | "S3Bucket" : { "Fn::Join" : ["-", ["elasticbeanstalk-samples", { "Ref" : "AWS::Region" }]]}, 23 | "S3Key" : "elasticbeanstalk-sampleapp.war" 24 | } 25 | }], 26 | "ConfigurationTemplates" : [{ 27 | "TemplateName" : "DefaultConfiguration", 28 | "Description" : "Default Configuration Version 1.0 - with SSH access", 29 | "SolutionStackName" : "64bit Amazon Linux running Tomcat 7", 30 | "OptionSettings" : [{ 31 | "Namespace" : "aws:autoscaling:launchconfiguration", 32 | "OptionName" : "EC2KeyName", 33 | "Value" : { "Ref" : "KeyName" } 34 | }] 35 | }] 36 | } 37 | }, 38 | "sampleEnvironment" : { 39 | "Type" : "AWS::ElasticBeanstalk::Environment", 40 | "Properties" : { 41 | "ApplicationName" : { "Ref" : "sampleApplication" }, 42 | "Description" : "AWS Elastic Beanstalk Environment running Sample Application", 43 | "TemplateName" : "DefaultConfiguration", 44 | "VersionLabel" : "Initial Version" 45 | } 46 | } 47 | }, 48 | "Outputs" : { 49 | "URL" : { 50 | "Description" : "URL of the AWS Elastic Beanstalk Environment", 51 | "Value" : { "Fn::GetAtt" : ["sampleEnvironment", "EndpointURL"] } 52 | } 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /ElasticBeanstalkSampleWithRoute53.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template ElasticBeanstalkSampleWithRoute53: Configure and launch the AWS Elastic Beanstalk sample application, specifying a custom DNS name using Amazon Route 53. Note, since AWS Elastic Beanstalk is only available in US-East-1, this template can only be used to create stacks in the US-East-1 region. **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "KeyName" : { 8 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the AWS Elastic Beanstalk instance", 9 | "Type" : "String" 10 | }, 11 | "DNSName" : { 12 | "Description" : "DNS name for the running environment. The fully qualified DNS name of the environment is created using the DNSName and the DNSZone parameters.", 13 | "Type" : "String" 14 | }, 15 | "DNSZone" : { 16 | "Description" : "The name of an existing Amazon Route 53 hosted zone. The fully qualified DNS name of the environment is created using the DNSName and the DNSZone parameters.", 17 | "Type" : "String" 18 | } 19 | }, 20 | 21 | "Resources" : { 22 | "sampleApplication" : { 23 | "Type" : "AWS::ElasticBeanstalk::Application", 24 | "Properties" : { 25 | "Description" : "AWS Elastic Beanstalk Sample Application", 26 | "ApplicationVersions" : [{ 27 | "VersionLabel" : "Initial Version", 28 | "Description" : "Version 1.0", 29 | "SourceBundle" : { 30 | "S3Bucket" : { "Fn::Join" : ["-", ["elasticbeanstalk", { "Ref" : "AWS::Region" }]]}, 31 | "S3Key" : "resources/elasticbeanstalk-sampleapp.war" 32 | } 33 | }], 34 | "ConfigurationTemplates" : [{ 35 | "TemplateName" : "DefaultConfiguration", 36 | "Description" : "Default Configuration Version 1.0 - with SSH access", 37 | "SolutionStackName" : "64bit Amazon Linux running Tomcat 7", 38 | "OptionSettings" : [{ 39 | "Namespace" : "aws:autoscaling:launchconfiguration", 40 | "OptionName" : "EC2KeyName", 41 | "Value" : { "Ref" : "KeyName" } 42 | }] 43 | }] 44 | } 45 | }, 46 | "sampleEnvironment" : { 47 | "Type" : "AWS::ElasticBeanstalk::Environment", 48 | "Properties" : { 49 | "ApplicationName" : { "Ref" : "sampleApplication" }, 50 | "Description" : "AWS Elastic Beanstalk Environment running Sample Application", 51 | "TemplateName" : "DefaultConfiguration", 52 | "VersionLabel" : "Initial Version" 53 | } 54 | }, 55 | "environmentDNSRecord" : { 56 | "Type" : "AWS::Route53::RecordSet", 57 | "Properties" : { 58 | "HostedZoneName" : { "Fn::Join" : [ "", [{"Ref" : "DNSZone"}, "." ]]}, 59 | "Comment" : "CNAME redirect to aws.amazon.com.", 60 | "Name" : { "Fn::Join" : [ "", [{"Ref" : "DNSName"}, ".", {"Ref" : "AWS::Region"}, ".", {"Ref" : "DNSZone"}]]}, 61 | "Type" : "CNAME", 62 | "TTL" : "900", 63 | "ResourceRecords" : [{ "Fn::GetAtt" : ["sampleEnvironment", "EndpointURL"] }] 64 | } 65 | } 66 | }, 67 | "Outputs" : { 68 | "URL" : { 69 | "Description" : "URL of the AWS Elastic Beanstalk Environment", 70 | "Value" : { "Fn::Join" : [ "", [ "http://", { "Ref" : "environmentDNSRecord" } ]]} 71 | } 72 | } 73 | } 74 | -------------------------------------------------------------------------------- /ElasticBeanstalk_Nodejs_Sample.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template ElasticBeanstalk Node.jsSample: Configure and launch the AWS Elastic Beanstalk sample application. **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "KeyName" : { 8 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the AWS Elastic Beanstalk instance", 9 | "Type" : "String" 10 | } 11 | }, 12 | 13 | "Resources" : { 14 | "sampleApplication" : { 15 | "Type" : "AWS::ElasticBeanstalk::Application", 16 | "Properties" : { 17 | "Description" : "AWS Elastic Beanstalk Sample Node.js Application", 18 | "ApplicationVersions" : [{ 19 | "VersionLabel" : "Initial Version", 20 | "Description" : "Version 1.0", 21 | "SourceBundle" : { 22 | "S3Bucket" : { "Fn::Join" : ["-", ["elasticbeanstalk-samples", { "Ref" : "AWS::Region" }]]}, 23 | "S3Key" : "nodejs-sample.zip" 24 | } 25 | }], 26 | "ConfigurationTemplates" : [{ 27 | "TemplateName" : "DefaultConfiguration", 28 | "Description" : "Default Configuration Version 1.0 - with SSH access", 29 | "SolutionStackName" : "64bit Amazon Linux running Node.js", 30 | "OptionSettings" : [{ 31 | "Namespace" : "aws:autoscaling:launchconfiguration", 32 | "OptionName" : "EC2KeyName", 33 | "Value" : { "Ref" : "KeyName" } 34 | }] 35 | }] 36 | } 37 | }, 38 | "sampleEnvironment" : { 39 | "Type" : "AWS::ElasticBeanstalk::Environment", 40 | "Properties" : { 41 | "ApplicationName" : { "Ref" : "sampleApplication" }, 42 | "Description" : "AWS Elastic Beanstalk Environment running Sample Node.js Application", 43 | "TemplateName" : "DefaultConfiguration", 44 | "VersionLabel" : "Initial Version" 45 | } 46 | } 47 | }, 48 | "Outputs" : { 49 | "URL" : { 50 | "Description" : "URL of the AWS Elastic Beanstalk Environment", 51 | "Value" : { "Fn::GetAtt" : ["sampleEnvironment", "EndpointURL"] } 52 | } 53 | } 54 | } 55 | -------------------------------------------------------------------------------- /ElasticBeanstalk_PHP_Sample.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template ElasticBeanstalk_PHP_Sample: Configure and launch the AWS Elastic Beanstalk PHP sample application. **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "KeyName" : { 8 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the AWS Elastic Beanstalk instance", 9 | "Type" : "String" 10 | } 11 | }, 12 | 13 | "Resources" : { 14 | "sampleApplication" : { 15 | "Type" : "AWS::ElasticBeanstalk::Application", 16 | "Properties" : { 17 | "Description" : "AWS Elastic Beanstalk PHP Sample Application", 18 | "ApplicationVersions" : [{ 19 | "VersionLabel" : "Initial Version", 20 | "Description" : "Version 1.0", 21 | "SourceBundle" : { 22 | "S3Bucket" : { "Fn::Join" : ["-", ["elasticbeanstalk-samples", { "Ref" : "AWS::Region" }]]}, 23 | "S3Key" : "php-sample.zip" 24 | } 25 | }], 26 | "ConfigurationTemplates" : [{ 27 | "TemplateName" : "DefaultConfiguration", 28 | "Description" : "Default Configuration Version 1.0 - with SSH access", 29 | "SolutionStackName" : "64bit Amazon Linux running PHP 5.3", 30 | "OptionSettings" : [{ 31 | "Namespace" : "aws:autoscaling:launchconfiguration", 32 | "OptionName" : "EC2KeyName", 33 | "Value" : { "Ref" : "KeyName" } 34 | }] 35 | }] 36 | } 37 | }, 38 | "sampleEnvironment" : { 39 | "Type" : "AWS::ElasticBeanstalk::Environment", 40 | "Properties" : { 41 | "ApplicationName" : { "Ref" : "sampleApplication" }, 42 | "Description" : "AWS Elastic Beanstalk Environment running PHP Sample Application", 43 | "TemplateName" : "DefaultConfiguration", 44 | "VersionLabel" : "Initial Version" 45 | } 46 | } 47 | }, 48 | "Outputs" : { 49 | "URL" : { 50 | "Description" : "URL of the AWS Elastic Beanstalk Environment", 51 | "Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : ["sampleEnvironment", "EndpointURL"] }]]} 52 | } 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /ElasticBeanstalk_Ruby_Sample.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template ElasticBeanstalk_Ruby_Sample: Configure and launch the AWS Elastic Beanstalk Ruby sample application. **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "KeyName" : { 8 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the AWS Elastic Beanstalk instance", 9 | "Type" : "String" 10 | } 11 | }, 12 | 13 | "Resources" : { 14 | "sampleApplication" : { 15 | "Type" : "AWS::ElasticBeanstalk::Application", 16 | "Properties" : { 17 | "Description" : "AWS Elastic Beanstalk Ruby Sample Application", 18 | "ApplicationVersions" : [{ 19 | "VersionLabel" : "Initial Version", 20 | "Description" : "Version 1.0", 21 | "SourceBundle" : { 22 | "S3Bucket" : { "Fn::Join" : ["-", ["elasticbeanstalk-samples", { "Ref" : "AWS::Region" }]]}, 23 | "S3Key" : "ruby-sample.zip" 24 | } 25 | }], 26 | "ConfigurationTemplates" : [{ 27 | "TemplateName" : "DefaultConfiguration", 28 | "Description" : "Default Configuration Version 1.0 - with SSH access", 29 | "SolutionStackName" : "64bit Amazon Linux running Ruby 1.9.3", 30 | "OptionSettings" : [{ 31 | "Namespace" : "aws:autoscaling:launchconfiguration", 32 | "OptionName" : "EC2KeyName", 33 | "Value" : { "Ref" : "KeyName" } 34 | }] 35 | }] 36 | } 37 | }, 38 | "sampleEnvironment" : { 39 | "Type" : "AWS::ElasticBeanstalk::Environment", 40 | "Properties" : { 41 | "ApplicationName" : { "Ref" : "sampleApplication" }, 42 | "Description" : "AWS Elastic Beanstalk Environment running Ruby Sample Application", 43 | "TemplateName" : "DefaultConfiguration", 44 | "VersionLabel" : "Initial Version" 45 | } 46 | } 47 | }, 48 | "Outputs" : { 49 | "URL" : { 50 | "Description" : "URL of the AWS Elastic Beanstalk Environment", 51 | "Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : ["sampleEnvironment", "EndpointURL"] }]]} 52 | } 53 | } 54 | } -------------------------------------------------------------------------------- /ElasticBeanstalk_Simple.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template ElasticBeanstalk_Simple: Configure and launch an AWS Elastic Beanstalk application that connects to an Amazon RDS database instance. Monitoring is setup on the database. **WARNING** This template creates one or more Amazon EC2 instances and an Amazon Relational Database Service database instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | 8 | "DatabaseUser": { 9 | "Default": "admin", 10 | "NoEcho": "true", 11 | "Type": "String", 12 | "Description" : "Test database admin account name", 13 | "MinLength": "1", 14 | "MaxLength": "16", 15 | "AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*", 16 | "ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters." 17 | }, 18 | 19 | "DatabasePassword": { 20 | "Default": "password", 21 | "NoEcho": "true", 22 | "Type": "String", 23 | "Description" : "Test database admin account password", 24 | "MinLength": "8", 25 | "MaxLength": "41", 26 | "AllowedPattern" : "[a-zA-Z0-9]*", 27 | "ConstraintDescription" : "must contain only alphanumeric characters." 28 | }, 29 | 30 | "OperatorEmail": { 31 | "Default": "nobody@amazon.com", 32 | "Description": "Email address to notify if there are any operational issues", 33 | "Type": "String" 34 | } 35 | }, 36 | 37 | "Resources" : { 38 | "SampleApplication" : { 39 | "Type" : "AWS::ElasticBeanstalk::Application", 40 | "Properties" : { 41 | "Description" : "AWS Elastic Beanstalk Sample Application", 42 | "ApplicationVersions" : [{ 43 | "VersionLabel" : "Initial Version", 44 | "Description" : "Version 1.0", 45 | "SourceBundle" : { 46 | "S3Bucket" : { "Fn::Join" : ["-", ["cloudformation-samples", { "Ref" : "AWS::Region" }]]}, 47 | "S3Key" : "CloudFormationBeanstalkRDSExample.war" 48 | } 49 | }], 50 | "ConfigurationTemplates" : [{ 51 | "TemplateName" : "DefaultConfiguration", 52 | "Description" : "Default Configuration Version 1.0 - with SSH access", 53 | "SolutionStackName" : "64bit Amazon Linux running Tomcat 7", 54 | "OptionSettings" : [{ 55 | "Namespace" : "aws:elasticbeanstalk:application:environment", 56 | "OptionName" : "JDBC_CONNECTION_STRING", 57 | "Value" : { "Fn::Join": [ "", [ "jdbc:mysql://", 58 | { "Fn::GetAtt": [ "SampleDB", "Endpoint.Address" ] }, 59 | ":", 60 | { "Fn::GetAtt": [ "SampleDB", "Endpoint.Port" ] }, 61 | "/beanstalkdb" ]]} 62 | },{ 63 | "Namespace" : "aws:elasticbeanstalk:application:environment", 64 | "OptionName" : "PARAM1", 65 | "Value" : { "Ref" : "DatabaseUser" } 66 | },{ 67 | "Namespace" : "aws:elasticbeanstalk:application:environment", 68 | "OptionName" : "PARAM2", 69 | "Value" : { "Ref" : "DatabasePassword" } 70 | }] 71 | }] 72 | } 73 | }, 74 | 75 | "SampleEnvironment" : { 76 | "Type" : "AWS::ElasticBeanstalk::Environment", 77 | "Properties" : { 78 | "ApplicationName" : { "Ref" : "SampleApplication" }, 79 | "Description" : "AWS Elastic Beanstalk Environment running Sample Application", 80 | "TemplateName" : "DefaultConfiguration", 81 | "VersionLabel" : "Initial Version" 82 | } 83 | }, 84 | 85 | "DBSecurityGroup": { 86 | "Type": "AWS::RDS::DBSecurityGroup", 87 | "Properties": { 88 | "DBSecurityGroupIngress": { 89 | "EC2SecurityGroupName": "elasticbeanstalk-default" 90 | }, 91 | "GroupDescription": "database access" 92 | } 93 | }, 94 | 95 | "SampleDB": { 96 | "Type": "AWS::RDS::DBInstance", 97 | "Properties": { 98 | "Engine": "MySQL", 99 | "DBName": "beanstalkdb", 100 | "MasterUsername": { "Ref": "DatabaseUser" }, 101 | "DBInstanceClass": "db.m1.small", 102 | "DBSecurityGroups": [{ "Ref": "DBSecurityGroup" }], 103 | "AllocatedStorage": "5", 104 | "MasterUserPassword": { "Ref": "DatabasePassword" } 105 | } 106 | }, 107 | 108 | "AlarmTopic": { 109 | "Type": "AWS::SNS::Topic", 110 | "Properties": { 111 | "Subscription": [{ "Endpoint": { "Ref": "OperatorEmail" }, "Protocol": "email" }] 112 | } 113 | }, 114 | 115 | "CPUAlarmHigh": { 116 | "Type" : "AWS::CloudWatch::Alarm", 117 | "Properties": { 118 | "EvaluationPeriods": "10", 119 | "Statistic": "Average", 120 | "Threshold": "50", 121 | "AlarmDescription": "Alarm if CPU too high or metric disappears indicating the RDS database instance is having issues", 122 | "Period": "60", 123 | "Namespace": "AWS/RDS", 124 | "MetricName": "CPUUtilization", 125 | "Dimensions": [ { 126 | "Name": "DBInstanceIdentifier", 127 | "Value": { "Ref": "SampleDB" } 128 | } ], 129 | "ComparisonOperator": "GreaterThanThreshold", 130 | "AlarmActions": [ { "Ref": "AlarmTopic" } ], 131 | "InsufficientDataActions": [ { "Ref": "AlarmTopic" } ] 132 | } 133 | } 134 | }, 135 | 136 | "Outputs" : { 137 | "URL" : { 138 | "Description" : "URL of the AWS Elastic Beanstalk Environment", 139 | "Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : [ "SampleEnvironment", "EndpointURL" ] }]]} 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /ElasticBeanstalk_Windows_Sample.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template ElasticBeanstalk_Windows_Sample: Configure and launch the AWS Elastic Beanstalk sample application running on Windows Server 2008 R2 running IIS 7.5. **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "KeyName" : { 8 | "Description" : "Name of an existing EC2 KeyPair to enable access to the AWS Elastic Beanstalk instance", 9 | "Type" : "String" 10 | } 11 | }, 12 | 13 | "Resources" : { 14 | "sampleApplication" : { 15 | "Type" : "AWS::ElasticBeanstalk::Application", 16 | "Properties" : { 17 | "Description" : "AWS Elastic Beanstalk Windows Sample Application", 18 | "ApplicationVersions" : [{ 19 | "VersionLabel" : "Initial Version", 20 | "Description" : "Version 1.0", 21 | "SourceBundle" : { 22 | "S3Bucket" : { "Fn::Join" : ["-", ["elasticbeanstalk-samples", { "Ref" : "AWS::Region" }]]}, 23 | "S3Key" : "FirstSample.zip" 24 | } 25 | }], 26 | "ConfigurationTemplates" : [{ 27 | "TemplateName" : "DefaultConfiguration", 28 | "Description" : "Default Configuration Version 1.0 - with SSH access", 29 | "SolutionStackName" : "64bit Windows Server 2008 R2 running IIS 7.5", 30 | "OptionSettings" : [{ 31 | "Namespace" : "aws:autoscaling:launchconfiguration", 32 | "OptionName" : "EC2KeyName", 33 | "Value" : { "Ref" : "KeyName" } 34 | }] 35 | }] 36 | } 37 | }, 38 | "sampleEnvironment" : { 39 | "Type" : "AWS::ElasticBeanstalk::Environment", 40 | "Properties" : { 41 | "ApplicationName" : { "Ref" : "sampleApplication" }, 42 | "Description" : "AWS Elastic Beanstalk Environment running Windows Sample Application", 43 | "TemplateName" : "DefaultConfiguration", 44 | "VersionLabel" : "Initial Version" 45 | } 46 | } 47 | }, 48 | "Outputs" : { 49 | "URL" : { 50 | "Description" : "URL of the AWS Elastic Beanstalk Environment", 51 | "Value" : { "Fn::Join" : [ "", [ "http://", { "Fn::GetAtt" : ["sampleEnvironment", "EndpointURL"] }]]} 52 | } 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /Gollum_Simple.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template Gollum_Simple: Gollum is a simple wiki system built on top of Git that powers GitHub Wikis. This template installs a Gollum Wiki stack on a single EC2 instance and demonstrates using the AWS CloudFormation bootstrap scripts to install the packages and files necessary at instance launch time. **WARNING** This template creates an Amazon EC2 instance. 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 | 16 | "Mappings" : { 17 | "AWSInstanceType2Arch" : { 18 | "t1.micro" : { "Arch" : "64" }, 19 | "m1.small" : { "Arch" : "64" }, 20 | "m1.medium" : { "Arch" : "64" }, 21 | "m1.large" : { "Arch" : "64" }, 22 | "m1.xlarge" : { "Arch" : "64" }, 23 | "m2.xlarge" : { "Arch" : "64" }, 24 | "m2.2xlarge" : { "Arch" : "64" }, 25 | "m2.4xlarge" : { "Arch" : "64" }, 26 | "m3.xlarge" : { "Arch" : "64" }, 27 | "m3.2xlarge" : { "Arch" : "64" }, 28 | "c1.medium" : { "Arch" : "64" }, 29 | "c1.xlarge" : { "Arch" : "64" }, 30 | "cc1.4xlarge" : { "Arch" : "64HVM" }, 31 | "cc2.8xlarge" : { "Arch" : "64HVM" }, 32 | "cg1.4xlarge" : { "Arch" : "64HVM" } 33 | }, 34 | 35 | "AWSRegionArch2AMI" : { 36 | "us-east-1" : { "32" : "ami-31814f58", "64" : "ami-1b814f72", "64HVM" : "ami-0da96764" }, 37 | "us-west-2" : { "32" : "ami-38fe7308", "64" : "ami-30fe7300", "64HVM" : "NOT_YET_SUPPORTED" }, 38 | "us-west-1" : { "32" : "ami-11d68a54", "64" : "ami-1bd68a5e", "64HVM" : "NOT_YET_SUPPORTED" }, 39 | "eu-west-1" : { "32" : "ami-973b06e3", "64" : "ami-953b06e1", "64HVM" : "NOT_YET_SUPPORTED" }, 40 | "ap-southeast-1" : { "32" : "ami-b4b0cae6", "64" : "ami-beb0caec", "64HVM" : "NOT_YET_SUPPORTED" }, 41 | "ap-southeast-2" : { "32" : "ami-b3990e89", "64" : "ami-bd990e87", "64HVM" : "NOT_YET_SUPPORTED" }, 42 | "ap-northeast-1" : { "32" : "ami-0644f007", "64" : "ami-0a44f00b", "64HVM" : "NOT_YET_SUPPORTED" }, 43 | "sa-east-1" : { "32" : "ami-3e3be423", "64" : "ami-3c3be421", "64HVM" : "NOT_YET_SUPPORTED" } 44 | } 45 | }, 46 | 47 | "Resources" : { 48 | 49 | "WebServer": { 50 | "Type": "AWS::EC2::Instance", 51 | "Metadata" : { 52 | "AWS::CloudFormation::Init" : { 53 | "config" : { 54 | "packages" : { 55 | "yum" : { 56 | "gcc" : [], 57 | "make" : [], 58 | "ruby-devel" : [], 59 | "ruby-rdoc" : [], 60 | "rubygems" : [], 61 | "libxml2-devel": [], 62 | "libxslt-devel": [], 63 | "git" : [] 64 | }, 65 | 66 | "rubygems" : { 67 | "nokogiri" : [], 68 | "rdiscount" : [], 69 | "gollum" : [] 70 | } 71 | } 72 | } 73 | } 74 | }, 75 | "Properties": { 76 | "ImageId" : { "Fn::FindInMap" : [ "AWSRegionArch2AMI", { "Ref" : "AWS::Region" }, 77 | { "Fn::FindInMap" : [ "AWSInstanceType2Arch", { "Ref" : "InstanceType" }, "Arch" ] } ] }, 78 | "InstanceType" : { "Ref" : "InstanceType" }, 79 | "SecurityGroups" : [ {"Ref" : "WebServerSecurityGroup"} ], 80 | "UserData" : { "Fn::Base64" : { "Fn::Join" : ["", [ 81 | "#!/bin/bash -v\n", 82 | "yum update -y aws-cfn-bootstrap\n", 83 | 84 | "# Helper function\n", 85 | "function error_exit\n", 86 | "{\n", 87 | " /opt/aws/bin/cfn-signal -e 1 -r \"$1\" '", { "Ref" : "WaitHandle" }, "'\n", 88 | " exit 1\n", 89 | "}\n", 90 | 91 | "# Install Rails packages\n", 92 | "/opt/aws/bin/cfn-init -s ", { "Ref" : "AWS::StackId" }, " -r WebServer ", 93 | " --region ", { "Ref" : "AWS::Region" }, " || error_exit 'Failed to run cfn-init'\n", 94 | 95 | "# Initialize the wiki and fire up the server\n", 96 | "mkdir /var/wikidata\n", 97 | "cd /var/wikidata\n", 98 | "git init\n", 99 | "gollum --port 80 --host 0.0.0.0 &\n", 100 | 101 | "# If all is well so signal success\n", 102 | "/opt/aws/bin/cfn-signal -e $? -r \"Rails application setup complete\" '", { "Ref" : "WaitHandle" }, "'\n" 103 | ]]}} 104 | } 105 | }, 106 | 107 | "WebServerSecurityGroup" : { 108 | "Type" : "AWS::EC2::SecurityGroup", 109 | "Properties" : { 110 | "GroupDescription" : "Enable HTTP access on the inbound port", 111 | "SecurityGroupIngress" : [ 112 | {"IpProtocol" : "tcp", "FromPort" : "80", "ToPort" : "80", "CidrIp" : "0.0.0.0/0"} 113 | ] 114 | } 115 | }, 116 | 117 | "WaitHandle" : { 118 | "Type" : "AWS::CloudFormation::WaitConditionHandle" 119 | }, 120 | 121 | "WaitCondition" : { 122 | "Type" : "AWS::CloudFormation::WaitCondition", 123 | "DependsOn" : "WebServer", 124 | "Properties" : { 125 | "Handle" : {"Ref" : "WaitHandle"}, 126 | "Timeout" : "300" 127 | } 128 | } 129 | }, 130 | 131 | "Outputs" : { 132 | "WebsiteURL" : { 133 | "Value" : { "Fn::Join" : ["", ["http://", { "Fn::GetAtt" : [ "WebServer", "PublicDnsName" ]}]] }, 134 | "Description" : "URL for Gollum wiki" 135 | } 136 | } 137 | } 138 | -------------------------------------------------------------------------------- /IAM_Policies_SNS_Publish_To_SQS.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template IAM_Policies_SNS_Publish_To_SQS: Sample template showing how to grant rights so that you can publish SNS notifications to an SQS queue. Note that you will need to specify the CAPABILITY_IAM flag when you create the stack to allow this template to execute. You can do this through the AWS management console by clicking on the check box acknowledging that you understand this template creates IAM resources or by specifying the CAPABILITY_IAM flag to the cfn-create-stack command line tool or CreateStack API call. **WARNING** This template creates an Amazon SQS queue and an Amazon SNS topic. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Resources" : { 7 | 8 | "SQSQueue" : { 9 | "Type" : "AWS::SQS::Queue" 10 | }, 11 | 12 | "SNSTopic" : { 13 | "Type" : "AWS::SNS::Topic", 14 | "Properties" : { 15 | "Subscription" : [{ 16 | "Protocol" : "sqs", 17 | "Endpoint" : { "Fn::GetAtt" : [ "SQSQueue", "Arn" ] } 18 | }] 19 | } 20 | }, 21 | 22 | "AllowSNS2SQSPolicy" : { 23 | "Type" : "AWS::SQS::QueuePolicy", 24 | "Properties" : { 25 | "Queues" : [ { "Ref" : "SQSQueue" } ], 26 | "PolicyDocument": { 27 | "Version": "2008-10-17", 28 | "Id": "PublicationPolicy", 29 | "Statement" : [ 30 | { 31 | "Sid": "Allow-SNS-SendMessage", 32 | "Effect": "Allow", 33 | "Principal" : { 34 | "AWS": "*" 35 | }, 36 | "Action": ["sqs:SendMessage"], 37 | "Resource": { "Fn::GetAtt" : [ "SQSQueue", "Arn" ] }, 38 | "Condition" : { 39 | "ArnEquals" : { 40 | "aws:SourceArn": { "Ref" : "SNSTopic" } 41 | } 42 | } 43 | } 44 | ] 45 | } 46 | } 47 | } 48 | }, 49 | 50 | "Outputs" : { 51 | "QueueArn" : { 52 | "Value" : { "Fn::GetAtt" : [ "SQSQueue", "Arn" ]}, 53 | "Description" : "ARN of SQS Queue" 54 | }, 55 | "TopicArn" : { 56 | "Value" : { "Ref" : "SNSTopic" }, 57 | "Description" : "ARN of SNS Topic" 58 | } 59 | } 60 | } 61 | 62 | -------------------------------------------------------------------------------- /IAM_Policies_for_S3.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template IAM_Policies_for_S3: Sample template showing how to create an IAM user with access to an S3 bucket via an IAM policy. Note that you will need to specify the CAPABILITY_IAM flag when you create the stack to allow this template to execute. You can do this through the AWS management console by clicking on the check box acknowledging that you understand this template creates IAM resources or by specifying the CAPABILITY_IAM flag to the cfn-create-stack command line tool or CreateStack API call. **WARNING** This template creates an Amazon S3 bucket. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Resources" : { 7 | 8 | "S3Bucket" : { 9 | "Type" : "AWS::S3::Bucket" 10 | }, 11 | 12 | "S3User" : { 13 | "Type" : "AWS::IAM::User" 14 | }, 15 | 16 | "BucketPolicy" : { 17 | "Type" : "AWS::S3::BucketPolicy", 18 | "Properties" : { 19 | "PolicyDocument": { 20 | "Version" : "2008-10-17", 21 | "Id" : "MyPolicy", 22 | "Statement" : [{ 23 | "Sid" : "ReadAccess", 24 | "Action" : ["s3:GetObject"], 25 | "Effect" : "Allow", 26 | "Resource" : { "Fn::Join" : ["", ["arn:aws:s3:::", {"Ref" : "S3Bucket"} , "/*"]]}, 27 | "Principal" : { "AWS": {"Fn::GetAtt" : ["S3User", "Arn"]} } 28 | }] 29 | }, 30 | "Bucket" : {"Ref" : "S3Bucket"} 31 | } 32 | } 33 | }, 34 | 35 | "Outputs" : { 36 | "BucketName" : { 37 | "Value" : { "Ref" : "S3Bucket" }, 38 | "Description" : "Name of newly created S3 bucket" 39 | } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /IAM_Users_Groups_and_Policies.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template IAM_Users_Groups_and_Policies: Sample template showing how to create IAM users, groups and policies. It creates a single user that is a member of a users group and an admin group. The groups each have different IAM policies associated with them. Note: This example also creates an AWSAccessKeyId/AWSSecretKey pair associated with the new user. The example is somewhat contrived since it creates all of the users and groups, typically you would be creating policies, users and/or groups that contain referemces to existing users or groups in your environment. Note that you will need to specify the CAPABILITY_IAM flag when you create the stack to allow this template to execute. You can do this through the AWS management console by clicking on the check box acknowledging that you understand this template creates IAM resources or by specifying the CAPABILITY_IAM flag to the cfn-create-stack command line tool or CreateStack API call. ", 5 | 6 | "Parameters" : { 7 | "Password": { 8 | "NoEcho": "true", 9 | "Type": "String", 10 | "Description" : "New account password", 11 | "MinLength": "1", 12 | "MaxLength": "41", 13 | "AllowedPattern" : "[a-zA-Z0-9]*", 14 | "ConstraintDescription" : "must contain only alphanumeric characters." 15 | } 16 | }, 17 | 18 | "Resources" : { 19 | "CFNUser" : { 20 | "Type" : "AWS::IAM::User", 21 | "Properties" : { 22 | "LoginProfile": { 23 | "Password": { "Ref" : "Password" } 24 | } 25 | } 26 | }, 27 | 28 | "CFNUserGroup" : { 29 | "Type" : "AWS::IAM::Group" 30 | }, 31 | 32 | "CFNAdminGroup" : { 33 | "Type" : "AWS::IAM::Group" 34 | }, 35 | 36 | "Users" : { 37 | "Type" : "AWS::IAM::UserToGroupAddition", 38 | "Properties" : { 39 | "GroupName": { "Ref" : "CFNUserGroup" }, 40 | "Users" : [ { "Ref" : "CFNUser" } ] 41 | } 42 | }, 43 | 44 | "Admins" : { 45 | "Type" : "AWS::IAM::UserToGroupAddition", 46 | "Properties" : { 47 | "GroupName": { "Ref" : "CFNAdminGroup" }, 48 | "Users" : [ { "Ref" : "CFNUser" } ] 49 | } 50 | }, 51 | 52 | "CFNUserPolicies" : { 53 | "Type" : "AWS::IAM::Policy", 54 | "Properties" : { 55 | "PolicyName" : "CFNUsers", 56 | "PolicyDocument" : { 57 | "Statement": [{ 58 | "Effect" : "Allow", 59 | "Action" : [ 60 | "cloudformation:Describe*", 61 | "cloudformation:List*", 62 | "cloudformation:Get*" 63 | ], 64 | "Resource" : "*" 65 | }] 66 | }, 67 | "Groups" : [{ "Ref" : "CFNUserGroup" }] 68 | } 69 | }, 70 | 71 | "CFNAdminPolicies" : { 72 | "Type" : "AWS::IAM::Policy", 73 | "Properties" : { 74 | "PolicyName" : "CFNAdmins", 75 | "PolicyDocument" : { 76 | "Statement": [{ 77 | "Effect" : "Allow", 78 | "Action" : "cloudformation:*", 79 | "Resource" : "*" 80 | }] 81 | }, 82 | "Groups" : [{ "Ref" : "CFNAdminGroup" }] 83 | } 84 | }, 85 | 86 | "CFNKeys" : { 87 | "Type" : "AWS::IAM::AccessKey", 88 | "Properties" : { 89 | "UserName" : { "Ref": "CFNUser" } 90 | } 91 | } 92 | }, 93 | 94 | "Outputs" : { 95 | "AccessKey" : { 96 | "Value" : { "Ref" : "CFNKeys" }, 97 | "Description" : "AWSAccessKeyId of new user" 98 | }, 99 | "SecretKey" : { 100 | "Value" : { "Fn::GetAtt" : ["CFNKeys", "SecretAccessKey"]}, 101 | "Description" : "AWSSecretKey of new user" 102 | } 103 | } 104 | } 105 | 106 | -------------------------------------------------------------------------------- /Mutually_Referencing_EC2_Security_Groups.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template Mutually_Referencing_EC2_Security_Groups: Sample template showing how to create 2 EC2 security groups that mutually reference each other", 5 | 6 | "Resources" : { 7 | "SGroup1" : { 8 | "Type" : "AWS::EC2::SecurityGroup", 9 | "Properties" : { 10 | "GroupDescription" : "EC2 Instance access" 11 | } 12 | }, 13 | "SGroup2" : { 14 | "Type" : "AWS::EC2::SecurityGroup", 15 | "Properties" : { 16 | "GroupDescription" : "EC2 Instance access" 17 | } 18 | }, 19 | "SGroup1Ingress" : { 20 | "Type" : "AWS::EC2::SecurityGroupIngress", 21 | "Properties" : { 22 | "GroupName" : { "Ref" : "SGroup1" }, 23 | "IpProtocol" : "tcp", 24 | "ToPort" : "80", 25 | "FromPort" : "80", 26 | "SourceSecurityGroupName" : { "Ref" : "SGroup2" } 27 | } 28 | }, 29 | "SGroup2Ingress" : { 30 | "Type" : "AWS::EC2::SecurityGroupIngress", 31 | "Properties" : { 32 | "GroupName" : { "Ref" : "SGroup2" }, 33 | "IpProtocol" : "tcp", 34 | "ToPort" : "80", 35 | "FromPort" : "80", 36 | "SourceSecurityGroupName" : { "Ref" : "SGroup1" } 37 | } 38 | } 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /Parameter_Validate.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template Parameter_Validate: Sample template showing how to validate string and numeric parameters. This template does not create any billable AWS Resources.", 5 | 6 | "Parameters" : { 7 | 8 | "NumberWithRange" : { 9 | "Type" : "Number", 10 | "MinValue" : "1", 11 | "MaxValue" : "10", 12 | "Default" : "2", 13 | "Description" : "Enter a number between 1 and 10, default is 2" 14 | }, 15 | "NumberWithAllowedValues" : { 16 | "Type" : "Number", 17 | "Default" : "2", 18 | "AllowedValues" : ["1", "2", "3", "10", "20"], 19 | "Description" : "Enter 1,2,3,10 or 20, default is 2" 20 | }, 21 | "StringWithLength" : { 22 | "Type" : "String", 23 | "Default" : "Hello World", 24 | "MaxLength" : "20", 25 | "MinLength" : "5", 26 | "Description" : "Enter a string, between 5 and 20 characters in length", 27 | "ConstraintDescription" : "must have beteen 5 and 20 characters" 28 | }, 29 | "StringWithAllowedValues" : { 30 | "Type" : "String", 31 | "Default" : "t1.micro", 32 | "AllowedValues" : ["t1.micro", "m1.small"], 33 | "Description" : "Enter t1.micro, m1.small, default is t1.micro" 34 | }, 35 | "StringWithRegex" : { 36 | "Type" : "String", 37 | "Default" : "Hello", 38 | "AllowedPattern" : "[A-Za-z0-9]+", 39 | "MaxLength" : "10", 40 | "Description" : "Enter a string with alpha-numeric characters only", 41 | "ConstraintDescription" : "must only contain upper and lower case letters and numbers" 42 | } 43 | }, 44 | 45 | "Resources" : { 46 | "myWaitHandle" : { 47 | "Type" : "AWS::CloudFormation::WaitConditionHandle" 48 | } 49 | }, 50 | "Outputs" : { 51 | "NumberWithRange" : { 52 | "Value" : {"Ref" : "NumberWithRange" } 53 | }, 54 | "NumberWithAllowedValues" : { 55 | "Value" : {"Ref" : "NumberWithAllowedValues" } 56 | }, 57 | "StringWithLength" : { 58 | "Value" : {"Ref" : "StringWithLength" } 59 | }, 60 | "StringWithAllowedValue" : { 61 | "Value" : {"Ref" : "StringWithAllowedValues" } 62 | }, 63 | "StringWithRegex" : { 64 | "Value" : {"Ref" : "StringWithRegex" } 65 | } 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /RDSDatabaseWithOptionalReadReplica.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion": "2010-09-09", 3 | 4 | "Description": "AWS CloudFormation Sample Template RDSDatabaseWithOptionalReadReplica.template: Sample template showing how to create a highly-available, RDS DBInstance version 5.6 with an optional 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.", 5 | 6 | "Parameters": { 7 | 8 | "DBName": { 9 | "Default": "MyDatabase", 10 | "Description": "The database name", 11 | "Type": "String", 12 | "MinLength": "1", 13 | "MaxLength": "64", 14 | "AllowedPattern": "[a-zA-Z][a-zA-Z0-9]*", 15 | "ConstraintDescription": "must begin with a letter and contain only alphanumeric characters." 16 | }, 17 | "DBUser": { 18 | "NoEcho": "true", 19 | "Description": "The database admin account username", 20 | "Type": "String", 21 | "MinLength": "1", 22 | "MaxLength": "16", 23 | "AllowedPattern": "[a-zA-Z][a-zA-Z0-9]*", 24 | "ConstraintDescription": "must begin with a letter and contain only alphanumeric characters." 25 | }, 26 | "DBPassword": { 27 | "NoEcho": "true", 28 | "Description": "The database admin account password", 29 | "Type": "String", 30 | "MinLength": "8", 31 | "MaxLength": "41", 32 | "AllowedPattern": "[a-zA-Z0-9]*", 33 | "ConstraintDescription": "must contain only alphanumeric characters." 34 | }, 35 | "DBAllocatedStorage": { 36 | "Default": "5", 37 | "Description": "The size of the database (Gb)", 38 | "Type": "Number", 39 | "MinValue": "5", 40 | "MaxValue": "1024", 41 | "ConstraintDescription": "must be between 5 and 1024Gb." 42 | }, 43 | "DBInstanceClass": { 44 | "Default": "db.m1.small", 45 | "Description": "The database instance type", 46 | "Type": "String", 47 | "AllowedValues": [ 48 | "db.t1.micro", 49 | "db.m1.small", 50 | "db.m1.medium", 51 | "db.m1.large", 52 | "db.m1.xlarge", 53 | "db.m2.xlarge", 54 | "db.m2.2xlarge", 55 | "db.m2.4xlarge", 56 | "db.cr1.8xlarge" 57 | ], 58 | "ConstraintDescription": "must select a valid database instance type." 59 | }, 60 | "EC2SecurityGroup": { 61 | "Default": "default", 62 | "Description": "The EC2 security group that contains instances that need access to the database", 63 | "Type": "String" 64 | }, 65 | "MultiAZ": { 66 | "Description": "Multi-AZ master database", 67 | "Type": "String", 68 | "Default": "false", 69 | "AllowedValues": [ 70 | "true", 71 | "false" 72 | ], 73 | "ConstraintDescription": "must be true or false." 74 | }, 75 | "ReadReplica": { 76 | "Description": "Create a read replica", 77 | "Type": "String", 78 | "Default": "false", 79 | "AllowedValues": [ 80 | "true", 81 | "false" 82 | ], 83 | "ConstraintDescription": "must be true or false." 84 | } 85 | }, 86 | 87 | "Conditions" : { 88 | "CreateReadReplica" : { "Fn::Equals" : [ {"Ref" : "ReadReplica"}, "true"] } 89 | }, 90 | 91 | "Resources": { 92 | "MasterDB": { 93 | "Type": "AWS::RDS::DBInstance", 94 | "Properties": { 95 | "DBName": { "Ref": "DBName" }, 96 | "AllocatedStorage": { "Ref": "DBAllocatedStorage" }, 97 | "DBInstanceClass": { "Ref": "DBInstanceClass" }, 98 | "Engine": "MySQL", 99 | "EngineVersion": "5.6", 100 | "DBSecurityGroups": [ { "Ref": "DBSecurityGroup" } ], 101 | "MasterUsername": { "Ref": "DBUser" }, 102 | "MasterUserPassword": { "Ref": "DBPassword" }, 103 | "MultiAZ": { "Ref": "MultiAZ" }, 104 | "Tags": [ { "Key": "Name", "Value": "Master Database" } ] 105 | }, 106 | "DeletionPolicy": "Snapshot" 107 | }, 108 | 109 | "ReplicaDB": { 110 | "Type": "AWS::RDS::DBInstance", 111 | "Condition" : "CreateReadReplica", 112 | "Properties": { 113 | "SourceDBInstanceIdentifier": { "Ref": "MasterDB" }, 114 | "DBInstanceClass": { "Ref": "DBInstanceClass" }, 115 | "Tags": [ { "Key": "Name", "Value": "Read Replica Database" } ] 116 | } 117 | }, 118 | 119 | "DBSecurityGroup": { 120 | "Type": "AWS::RDS::DBSecurityGroup", 121 | "Properties": { 122 | "DBSecurityGroupIngress": { "EC2SecurityGroupName": { "Ref": "EC2SecurityGroup" } }, 123 | "GroupDescription": "database access" 124 | } 125 | } 126 | }, 127 | 128 | "Outputs": { 129 | "MasterJDBCConnectionString": { 130 | "Description": "JDBC connection string for the master database", 131 | "Value": { 132 | "Fn::Join": [ "", [ "jdbc:mysql://", { "Fn::GetAtt": [ "MasterDB", "Endpoint.Address" ] }, ":", { "Fn::GetAtt": [ "MasterDB", "Endpoint.Port" ] }, "/", { "Ref": "DBName" } ] ] 133 | } 134 | }, 135 | 136 | "ReplicaJDBCConnectionString": { 137 | "Condition" : "CreateReadReplica", 138 | "Description": "JDBC connection string for the replica database", 139 | "Value": { "Fn::Join": [ "", [ "jdbc:mysql://", { "Fn::GetAtt": [ "ReplicaDB", "Endpoint.Address" ] }, ":", { "Fn::GetAtt": [ "ReplicaDB", "Endpoint.Port" ] }, "/", { "Ref": "DBName" } ] ] } 140 | } 141 | } 142 | } 143 | -------------------------------------------------------------------------------- /RDS_MySQL_55_With_Tags.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template RDS_MySQL_55_With_Tags: Sample template showing how to create an RDS DBInstance version 5.5 with tags and alarming on important metrics that indicate the health of the database **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.", 5 | 6 | "Parameters": { 7 | "DBName": { 8 | "Default": "MyDatabase", 9 | "Description" : "The database name", 10 | "Type": "String", 11 | "MinLength": "1", 12 | "MaxLength": "64", 13 | "AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*", 14 | "ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters." 15 | }, 16 | "DBUser": { 17 | "NoEcho": "true", 18 | "Description" : "The database admin account username", 19 | "Type": "String", 20 | "MinLength": "1", 21 | "MaxLength": "16", 22 | "AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*", 23 | "ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters." 24 | }, 25 | "DBPassword": { 26 | "NoEcho": "true", 27 | "Description" : "The database admin account password", 28 | "Type": "String", 29 | "MinLength": "8", 30 | "MaxLength": "41", 31 | "AllowedPattern" : "[a-zA-Z0-9]*", 32 | "ConstraintDescription" : "must contain only alphanumeric characters." 33 | }, 34 | "DBAllocatedStorage": { 35 | "Default": "5", 36 | "Description" : "The size of the database (Gb)", 37 | "Type": "Number", 38 | "MinValue": "5", 39 | "MaxValue": "1024", 40 | "ConstraintDescription" : "must be between 5 and 1024Gb." 41 | }, 42 | "DBInstanceClass": { 43 | "Default": "db.m1.small", 44 | "Description" : "The database instance type", 45 | "Type": "String", 46 | "AllowedValues" : [ "db.m1.small", "db.m1.large", "db.m1.xlarge", "db.m2.xlarge", "db.m2.2xlarge", "db.m2.4xlarge" ], 47 | "ConstraintDescription" : "must select a valid database instance type." 48 | } 49 | }, 50 | 51 | "Mappings" : { 52 | "InstanceTypeMap" : { 53 | "db.m1.small" : { 54 | "CPULimit" : "60", 55 | "FreeStorageSpaceLimit" : "1024", 56 | "ReadIOPSLimit" : "100", 57 | "WriteIOPSLimit" : "100" 58 | }, 59 | "db.m1.large" : { 60 | "CPULimit" : "60", 61 | "FreeStorageSpaceLimit" : "1024", 62 | "ReadIOPSLimit" : "100", 63 | "WriteIOPSLimit" : "100" 64 | }, 65 | "db.m1.xlarge" : { 66 | "CPULimit" : "60", 67 | "FreeStorageSpaceLimit" : "1024", 68 | "ReadIOPSLimit" : "100", 69 | "WriteIOPSLimit" : "100" 70 | }, 71 | "db.m2.xlarge" : { 72 | "CPULimit" : "60", 73 | "FreeStorageSpaceLimit" : "1024", 74 | "ReadIOPSLimit" : "100", 75 | "WriteIOPSLimit" : "100" 76 | }, 77 | "db.m2.2xlarge" : { 78 | "CPULimit" : "60", 79 | "FreeStorageSpaceLimit" : "1024", 80 | "ReadIOPSLimit" : "100", 81 | "WriteIOPSLimit" : "100" 82 | }, 83 | "db.m2.4xlarge" : { 84 | "CPULimit" : "60", 85 | "FreeStorageSpaceLimit" : "1024", 86 | "ReadIOPSLimit" : "100", 87 | "WriteIOPSLimit" : "100" 88 | } 89 | } 90 | }, 91 | 92 | "Resources" : { 93 | 94 | "MyDB" : { 95 | "Type" : "AWS::RDS::DBInstance", 96 | "Properties" : { 97 | "DBName" : { "Ref" : "DBName" }, 98 | "AllocatedStorage" : { "Ref" : "DBAllocatedStorage" }, 99 | "DBInstanceClass" : { "Ref" : "DBInstanceClass" }, 100 | "Engine" : "MySQL", 101 | "EngineVersion" : "5.5", 102 | "MasterUsername" : { "Ref" : "DBUser" }, 103 | "MasterUserPassword" : { "Ref" : "DBPassword" }, 104 | "Tags" : [{ 105 | "Key" : "Name", 106 | "Value" : "My SQL Database" 107 | }] 108 | }, 109 | "DeletionPolicy" : "Snapshot" 110 | } 111 | }, 112 | 113 | "Outputs" : { 114 | "JDBCConnectionString": { 115 | "Description" : "JDBC connection string for database", 116 | "Value" : { "Fn::Join": [ "", [ "jdbc:mysql://", 117 | { "Fn::GetAtt": [ "MyDB", "Endpoint.Address" ] }, 118 | ":", 119 | { "Fn::GetAtt": [ "MyDB", "Endpoint.Port" ] }, 120 | "/", 121 | { "Ref": "DBName" }]]} 122 | }, 123 | "DBAddress" : { 124 | "Description" : "Address of database endpoint", 125 | "Value" : { "Fn::GetAtt": [ "MyDB", "Endpoint.Address" ] } 126 | }, 127 | "DBPort" : { 128 | "Description" : "Database endpoint port number", 129 | "Value" : { "Fn::GetAtt": [ "MyDB", "Endpoint.Port" ] } 130 | } 131 | } 132 | } 133 | -------------------------------------------------------------------------------- /RDS_Oracle.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template RDS_Oracle: Sample template showing how to create an RDS Oracle DBInstance. **WARNING** This template creates an Amazon RDS database instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Resources" : { 7 | 8 | "MyDB" : { 9 | "Type" : "AWS::RDS::DBInstance", 10 | "Properties" : { 11 | "AllocatedStorage" : "10", 12 | "DBInstanceClass" : "db.m1.small", 13 | "Engine" : "oracle-ee", 14 | "LicenseModel" : "bring-your-own-license", 15 | "MasterUsername" : "MyName", 16 | "MasterUserPassword" : "MyPassword" 17 | } 18 | } 19 | } 20 | } 21 | 22 | -------------------------------------------------------------------------------- /RDS_PIOPS.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template RDS_PIOPS: Sample template showing how to create an Amazon RDS Database Instance with provisioned IOPs.**WARNING** This template creates an Amazon Relational Database Service database instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters": { 7 | "DBUser": { 8 | "NoEcho": "true", 9 | "Description" : "The database admin account username", 10 | "Type": "String", 11 | "MinLength": "1", 12 | "MaxLength": "16", 13 | "AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*", 14 | "ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters." 15 | }, 16 | "DBPassword": { 17 | "NoEcho": "true", 18 | "Description" : "The database admin account password", 19 | "Type": "String", 20 | "MinLength": "8", 21 | "MaxLength": "41", 22 | "AllowedPattern" : "[a-zA-Z0-9]*", 23 | "ConstraintDescription" : "must contain only alphanumeric characters." 24 | } 25 | }, 26 | 27 | "Resources" : { 28 | "MyDB" : { 29 | "Type" : "AWS::RDS::DBInstance", 30 | "Properties" : { 31 | "AllocatedStorage" : "100", 32 | "DBInstanceClass" : "db.m1.small", 33 | "Engine" : "MySQL", 34 | "EngineVersion" : "5.5", 35 | "Iops" : "1000", 36 | "MasterUsername" : { "Ref" : "DBUser" }, 37 | "MasterUserPassword" : { "Ref" : "DBPassword" } 38 | } 39 | } 40 | } 41 | } 42 | 43 | -------------------------------------------------------------------------------- /RDS_Snapshot_On_Delete.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template RDS_Snapshot_On_Delete: Sample template showing how to create an RDS DBInstance that is snapshotted on stack deletion. **WARNING** This template creates an Amazon RDS database instance. When the stack is deleted a database snpshot will be left in your account. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Resources" : { 7 | "MyDB" : { 8 | "Type" : "AWS::RDS::DBInstance", 9 | "Properties" : { 10 | "AllocatedStorage" : "5", 11 | "DBInstanceClass" : "db.m1.small", 12 | "Engine" : "MySQL", 13 | "MasterUsername" : "MyName", 14 | "MasterUserPassword" : "MyPassword" 15 | }, 16 | "DeletionPolicy" : "Snapshot" 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /RDS_VPC.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template VPC_RDS_DB_Instance: Sample template showing how to create an RDS DBInstance in an existing Virtual Private Cloud (VPC). **WARNING** This template creates an Amazon Relational Database Service database instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | 8 | "VpcId" : { 9 | "Type" : "String", 10 | "Description" : "VpcId of your existing Virtual Private Cloud (VPC)" 11 | }, 12 | 13 | "Subnets" : { 14 | "Type" : "CommaDelimitedList", 15 | "Description" : "The list of SubnetIds, for at least two Availability Zones in the region in your Virtual Private Cloud (VPC)" 16 | }, 17 | 18 | "DBName": { 19 | "Default": "MyDatabase", 20 | "Description" : "The database name", 21 | "Type": "String", 22 | "MinLength": "1", 23 | "MaxLength": "64", 24 | "AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*", 25 | "ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters." 26 | }, 27 | 28 | "DBUsername": { 29 | "Default": "admin", 30 | "NoEcho": "true", 31 | "Description" : "The database admin account username", 32 | "Type": "String", 33 | "MinLength": "1", 34 | "MaxLength": "16", 35 | "AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*", 36 | "ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters." 37 | }, 38 | 39 | "DBPassword": { 40 | "Default": "password", 41 | "NoEcho": "true", 42 | "Description" : "The database admin account password", 43 | "Type": "String", 44 | "MinLength": "8", 45 | "MaxLength": "41", 46 | "AllowedPattern" : "[a-zA-Z0-9]*", 47 | "ConstraintDescription" : "must contain only alphanumeric characters." 48 | }, 49 | 50 | "DBClass" : { 51 | "Default" : "db.m1.small", 52 | "Description" : "Database instance class", 53 | "Type" : "String", 54 | "AllowedValues" : [ "db.m1.small", "db.m1.large", "db.m1.xlarge", "db.m2.xlarge", "db.m2.2xlarge", "db.m2.4xlarge" ], 55 | "ConstraintDescription" : "must select a valid database instance type." 56 | }, 57 | 58 | "DBAllocatedStorage" : { 59 | "Default": "5", 60 | "Description" : "The size of the database (Gb)", 61 | "Type": "Number", 62 | "MinValue": "5", 63 | "MaxValue": "1024", 64 | "ConstraintDescription" : "must be between 5 and 1024Gb." 65 | } 66 | }, 67 | 68 | "Resources" : { 69 | 70 | "MyDBSubnetGroup" : { 71 | "Type" : "AWS::RDS::DBSubnetGroup", 72 | "Properties" : { 73 | "DBSubnetGroupDescription" : "Subnets available for the RDS DB Instance", 74 | "SubnetIds" : { "Ref" : "Subnets" } 75 | } 76 | }, 77 | 78 | 79 | "myVPCSecurityGroup" : { 80 | "Type" : "AWS::EC2::SecurityGroup", 81 | "Properties" : 82 | { 83 | "GroupDescription" : "Security group for RDS DB Instance.", 84 | "VpcId" : { "Ref" : "VpcId" } 85 | } 86 | }, 87 | 88 | "MyDB" : { 89 | "Type" : "AWS::RDS::DBInstance", 90 | "Properties" : { 91 | "DBName" : { "Ref" : "DBName" }, 92 | "AllocatedStorage" : { "Ref" : "DBAllocatedStorage" }, 93 | "DBInstanceClass" : { "Ref" : "DBClass" }, 94 | "Engine" : "MySQL", 95 | "EngineVersion" : "5.5", 96 | "MasterUsername" : { "Ref" : "DBUsername" } , 97 | "MasterUserPassword" : { "Ref" : "DBPassword" }, 98 | "DBSubnetGroupName" : { "Ref" : "MyDBSubnetGroup" }, 99 | "VPCSecurityGroups" : [ { "Ref" : "myVPCSecurityGroup" } ] 100 | } 101 | } 102 | }, 103 | 104 | "Outputs" : { 105 | "JDBCConnectionString": { 106 | "Description" : "JDBC connection string for database", 107 | "Value" : { "Fn::Join": [ "", [ "jdbc:mysql://", 108 | { "Fn::GetAtt": [ "MyDB", "Endpoint.Address" ] }, 109 | ":", 110 | { "Fn::GetAtt": [ "MyDB", "Endpoint.Port" ] }, 111 | "/", 112 | { "Ref": "DBName" }]]} 113 | } 114 | } 115 | } 116 | -------------------------------------------------------------------------------- /RDS_Version.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template RDS_Version: Sample template showing how to create an RDS DBInstance using a specific engine version - in this case the latest of the V5.5 family. **WARNING** This template creates an Amazon Relational Database Service database instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Resources" : { 7 | "MyDB" : { 8 | "Type" : "AWS::RDS::DBInstance", 9 | "Properties" : { 10 | "AllocatedStorage" : "5", 11 | "DBInstanceClass" : "db.m1.small", 12 | "Engine" : "MySQL", 13 | "EngineVersion" : "5.5", 14 | "MasterUsername" : "MyName", 15 | "MasterUserPassword" : "MyPassword" 16 | } 17 | } 18 | } 19 | } 20 | 21 | -------------------------------------------------------------------------------- /RDS_with_DBParameterGroup.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template RDS_with_DBParameterGroup: Sample template showing how to create an Amazon RDS Database Instance with a DBParameterGroup.**WARNING** This template creates an Amazon Relational Database Service database instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters": { 7 | "DBUser": { 8 | "NoEcho": "true", 9 | "Description" : "The database admin account username", 10 | "Type": "String", 11 | "MinLength": "1", 12 | "MaxLength": "16", 13 | "AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*", 14 | "ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters." 15 | }, 16 | "DBPassword": { 17 | "NoEcho": "true", 18 | "Description" : "The database admin account password", 19 | "Type": "String", 20 | "MinLength": "8", 21 | "MaxLength": "41", 22 | "AllowedPattern" : "[a-zA-Z0-9]*", 23 | "ConstraintDescription" : "must contain only alphanumeric characters." 24 | } 25 | }, 26 | 27 | "Resources" : { 28 | "MyDB" : { 29 | "Type" : "AWS::RDS::DBInstance", 30 | "Properties" : { 31 | "AllocatedStorage" : "5", 32 | "DBInstanceClass" : "db.m1.small", 33 | "Engine" : "MySQL", 34 | "EngineVersion" : "5.5", 35 | "MasterUsername" : { "Ref" : "DBUser" }, 36 | "MasterUserPassword" : { "Ref" : "DBPassword" }, 37 | "DBParameterGroupName" : { "Ref" : "MyRDSParamGroup" } 38 | } 39 | }, 40 | 41 | "MyRDSParamGroup" : { 42 | "Type": "AWS::RDS::DBParameterGroup", 43 | "Properties" : { 44 | "Family" : "MySQL5.5", 45 | "Description" : "CloudFormation Sample Database Parameter Group", 46 | "Parameters" : { 47 | "autocommit" : "1" , 48 | "general_log" : "1", 49 | "old_passwords" : "0" 50 | } 51 | } 52 | } 53 | } 54 | } 55 | 56 | -------------------------------------------------------------------------------- /Route53_A.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template Route53_A: Sample template showing how to create an Amazon Route 53 A record that maps to the public IP address of an EC2 instance. It assumes that you already have a Hosted Zone registered with Amazon Route 53. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "HostedZone" : { 8 | "Type" : "String", 9 | "Description" : "The DNS name of an existing Amazon Route 53 hosted zone" 10 | } 11 | }, 12 | 13 | "Mappings" : { 14 | "RegionMap" : { 15 | "us-east-1" : { "AMI" : "ami-7f418316" }, 16 | "us-west-1" : { "AMI" : "ami-951945d0" }, 17 | "us-west-2" : { "AMI" : "ami-16fd7026" }, 18 | "eu-west-1" : { "AMI" : "ami-24506250" }, 19 | "sa-east-1" : { "AMI" : "ami-3e3be423" }, 20 | "ap-southeast-1" : { "AMI" : "ami-74dda626" }, 21 | "ap-southeast-2" : { "AMI" : "ami-b3990e89" }, 22 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" } 23 | } 24 | }, 25 | 26 | "Resources" : { 27 | "Ec2Instance" : { 28 | "Type" : "AWS::EC2::Instance", 29 | "Properties" : { 30 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]} 31 | } 32 | }, 33 | "myDNSRecord" : { 34 | "Type" : "AWS::Route53::RecordSet", 35 | "Properties" : { 36 | "HostedZoneName" : { "Fn::Join" : [ "", [{"Ref" : "HostedZone"}, "." ]]}, 37 | "Comment" : "DNS name for my instance.", 38 | "Name" : { "Fn::Join" : [ "", [{"Ref" : "Ec2Instance"}, ".", {"Ref" : "AWS::Region"}, ".", {"Ref" : "HostedZone"} ,"."]]}, 39 | "Type" : "A", 40 | "TTL" : "900", 41 | "ResourceRecords" : [ { "Fn::GetAtt" : [ "Ec2Instance", "PublicIp" ] } ] 42 | } 43 | } 44 | }, 45 | "Outputs" : { 46 | "DomainName" : { 47 | "Value" : { "Ref" : "myDNSRecord" } 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Route53_CNAME.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template Route53_CNAME: Sample template showing how to create an Amazon Route 53 CNAME record. 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.", 5 | 6 | "Parameters" : { 7 | "HostedZone" : { 8 | "Type" : "String", 9 | "Description" : "The DNS name of an existing Amazon Route 53 hosted zone" 10 | } 11 | }, 12 | 13 | "Resources" : { 14 | "myDNSRecord" : { 15 | "Type" : "AWS::Route53::RecordSet", 16 | "Properties" : { 17 | "HostedZoneName" : { "Fn::Join" : [ "", [{"Ref" : "HostedZone"}, "." ]]}, 18 | "Comment" : "CNAME redirect to aws.amazon.com.", 19 | "Name" : { "Fn::Join" : [ "", [{"Ref" : "AWS::StackName"}, ".", {"Ref" : "AWS::Region"}, ".", {"Ref" : "HostedZone"}, "."]]}, 20 | "Type" : "CNAME", 21 | "TTL" : "900", 22 | "ResourceRecords" : ["aws.amazon.com"] 23 | } 24 | } 25 | }, 26 | "Outputs" : { 27 | "CNAME" : { 28 | "Value" : { "Ref" : "myDNSRecord" } 29 | } 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /Route53_RoundRobin.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "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.", 5 | 6 | "Parameters" : { 7 | "HostedZone" : { 8 | "Type" : "String", 9 | "Description" : "The DNS name of an existing Amazon Route 53 hosted zone" 10 | } 11 | }, 12 | 13 | "Resources" : { 14 | "myDNSRecord" : { 15 | "Type" : "AWS::Route53::RecordSetGroup", 16 | "Properties" : { 17 | "HostedZoneName" : { "Fn::Join" : [ "", [{"Ref" : "HostedZone"}, "." ]]}, 18 | "Comment" : "Contrived example to redirect to aws.amazon.com 75% of the time and www.amazon.com 25% of the time.", 19 | "RecordSets" : [{ 20 | "SetIdentifier" : { "Fn::Join" : [ " ", [{"Ref" : "AWS::StackId"}, "AWS" ]]}, 21 | "Name" : { "Fn::Join" : [ "", [{"Ref" : "AWS::StackId"}, ".", {"Ref" : "AWS::Region"}, ".", {"Ref" : "HostedZone"}, "."]]}, 22 | "Type" : "CNAME", 23 | "TTL" : "900", 24 | "ResourceRecords" : ["aws.amazon.com"], 25 | "Weight" : "3" 26 | },{ 27 | "SetIdentifier" : { "Fn::Join" : [ " ", [{"Ref" : "AWS::StackId"}, "Amazon" ]]}, 28 | "Name" : { "Fn::Join" : [ "", [{"Ref" : "AWS::StackId"}, ".", {"Ref" : "AWS::Region"}, ".", {"Ref" : "HostedZone"}, "."]]}, 29 | "Type" : "CNAME", 30 | "TTL" : "900", 31 | "ResourceRecords" : ["www.amazon.com"], 32 | "Weight" : "1" 33 | }] 34 | } 35 | } 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /S3Bucket_Lockdown_to_IAM_User.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template S3Bucket_Lockdown_to_IAM_User: Simple test template showing how to create a bucket and an IAM user and lock the bucket down to be accessible by that new user. **WARNING** This template creates an Amazon S3 Bucket. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | 8 | "Password" : { 9 | "Type" : "String", 10 | "Description" : "IAM user login password", 11 | "NoEcho" : "true", 12 | "MinLength" : "3", 13 | "MaxLength" : "50" 14 | } 15 | }, 16 | 17 | "Resources" : { 18 | 19 | "S3Bucket" : { 20 | "Type" : "AWS::S3::Bucket" 21 | }, 22 | 23 | "BucketPolicy" : { 24 | "Type" : "AWS::S3::BucketPolicy", 25 | "Properties" : { 26 | "PolicyDocument": { 27 | "Id" : "Give access to user", 28 | "Statement" : [{ 29 | "Sid" : "AllAccess", 30 | "Action" : ["s3:*"], 31 | "Effect" : "Allow", 32 | "Resource" : { "Fn::Join" : ["", ["arn:aws:s3:::", {"Ref" : "S3Bucket"} ]]}, 33 | "Principal" : { "AWS": {"Fn::GetAtt" : ["S3User", "Arn"]} } 34 | }] 35 | }, 36 | "Bucket" : {"Ref" : "S3Bucket"} 37 | } 38 | }, 39 | 40 | "S3User" : { 41 | "Type" : "AWS::IAM::User", 42 | "Properties" : { 43 | "LoginProfile": { 44 | "Password": { "Ref" : "Password" } 45 | }, 46 | "Policies" : [{ 47 | "PolicyName" : "S3Access", 48 | "PolicyDocument" : { 49 | "Statement": [{ 50 | "Effect" : "Allow", 51 | "Action" : "s3:ListAllMyBuckets", 52 | "Resource" : "*" 53 | },{ 54 | "Effect" : "Allow", 55 | "Action" : "s3:*", 56 | "Resource" : { "Fn::Join" : ["", ["arn:aws:s3:::", {"Ref" : "S3Bucket"} , "/*"]]} 57 | }] 58 | } 59 | }] 60 | } 61 | } 62 | }, 63 | 64 | "Outputs" : { 65 | "IAMUser" : { 66 | "Value" : { "Ref" : "S3User" }, 67 | "Description" : "IAM User for customer" 68 | }, 69 | 70 | "BucketName" : { 71 | "Value" : { "Ref" : "S3Bucket" }, 72 | "Description" : "Name of newly created customer S3 bucket" 73 | } 74 | } 75 | } 76 | -------------------------------------------------------------------------------- /S3_Bucket.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template S3_Bucket: Sample template showing how to create a publicly accessible S3 bucket. **WARNING** This template creates an S3 bucket. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Resources" : { 7 | "S3Bucket" : { 8 | "Type" : "AWS::S3::Bucket", 9 | "Properties" : { 10 | "AccessControl" : "PublicRead" 11 | } 12 | } 13 | }, 14 | 15 | "Outputs" : { 16 | "BucketName" : { 17 | "Value" : { "Ref" : "S3Bucket" }, 18 | "Description" : "Name of S3 bucket to hold website content" 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /S3_Bucket_With_Tags.template: -------------------------------------------------------------------------------- 1 | { 2 | 3 | "AWSTemplateFormatVersion": "2010-09-09", 4 | 5 | "Description": "AWS CloudFormation Sample Template S3_Bucket_With_Tags: Sample template showing how to create a publicly accessible S3 bucket that has tags. **WARNING** This template creates an S3 bucket. You will be billed for the AWS resources used if you create a stack from this template.", 6 | 7 | "Resources": { 8 | "S3Bucket": { 9 | "Type": "AWS::S3::Bucket", 10 | "Properties": { 11 | "AccessControl": "PublicRead", 12 | "Tags" : [{ 13 | "Key" : "Name", 14 | "Value" : "My Bucket" 15 | }] 16 | } 17 | } 18 | }, 19 | 20 | "Outputs": { 21 | "BucketName": { 22 | "Value": { 23 | "Ref": "S3Bucket" 24 | }, 25 | "Description": "Name of S3 bucket to hold website content" 26 | } 27 | } 28 | 29 | } 30 | -------------------------------------------------------------------------------- /S3_Website_Bucket_With_Retain_On_Delete.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template S3_Website_Bucket_With_Retain_On_Delete: Sample template showing how to create a publicly accessible S3 bucket configured for website access with a deletion policy of retail on delete. **WARNING** This template creates an S3 bucket that will NOT be deleted when the stack is deleted. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Resources" : { 7 | "S3Bucket" : { 8 | "Type" : "AWS::S3::Bucket", 9 | "Properties" : { 10 | "AccessControl" : "PublicRead", 11 | "WebsiteConfiguration" : { 12 | "IndexDocument" : "index.html", 13 | "ErrorDocument" : "error.html" 14 | } 15 | }, 16 | "DeletionPolicy" : "Retain" 17 | } 18 | }, 19 | 20 | "Outputs" : { 21 | "WebsiteURL" : { 22 | "Value" : { "Fn::GetAtt" : [ "S3Bucket", "WebsiteURL" ] }, 23 | "Description" : "URL for website hosted on S3" 24 | }, 25 | "S3BucketSecureURL" : { 26 | "Value" : { "Fn::Join" : [ "", [ "https://", { "Fn::GetAtt" : [ "S3Bucket", "DomainName" ] } ] ] }, 27 | "Description" : "Name of S3 bucket to hold website content" 28 | } 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /S3_Website_With_CloudFront_Distribution.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template S3_Website_With_CloudFront_Distribution: Sample template showing how to create a website with a custom DNS name, hosted on Amazon S3 and served via Amazone CloudFront. It assumes you already have a Hosted Zone registered with Amazon Route 53. **WARNING** This template creates an Amazon Route 53 DNS record, an S3 bucket and a CloudFront distribution. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "HostedZone" : { 8 | "Type" : "String", 9 | "Description" : "The DNS name of an existing Amazon Route 53 hosted zone" 10 | } 11 | }, 12 | 13 | "Resources" : { 14 | "S3BucketForWebsiteContent" : { 15 | "Type" : "AWS::S3::Bucket", 16 | "Properties" : { 17 | "AccessControl" : "PublicRead", 18 | "WebsiteConfiguration" : { 19 | "IndexDocument" : "index.html", 20 | "ErrorDocument" : "error.html" 21 | } 22 | } 23 | }, 24 | 25 | "WebsiteCDN" : { 26 | "Type" : "AWS::CloudFront::Distribution", 27 | "Properties" : { 28 | "DistributionConfig" : { 29 | "Comment" : "CDN for S3-backed website", 30 | "CustomOrigin" : { 31 | "DNSName": { "Fn::Join" : ["", [{"Ref" : "S3BucketForWebsiteContent"}, ".s3-website-", {"Ref" : "AWS::Region"}, ".amazonaws.com"]]}, 32 | "HTTPPort" : "80", 33 | "HTTPSPort" : "443", 34 | "OriginProtocolPolicy" : "http-only" 35 | }, 36 | "Enabled" : "true", 37 | "DefaultRootObject" : "index.html", 38 | "CNAMEs" : [{ "Fn::Join" : [ "", [{"Ref" : "AWS::StackId"}, ".", {"Ref" : "AWS::Region"}, ".", { "Ref" : "HostedZone" }]]}] 39 | } 40 | } 41 | }, 42 | 43 | "WebsiteDNSName" : { 44 | "Type" : "AWS::Route53::RecordSet", 45 | "Properties" : { 46 | "HostedZoneName" : { "Fn::Join" : [ "", [{ "Ref" : "HostedZone" }, "."]]}, 47 | "Comment" : "CNAME redirect custom name to CloudFront distribution", 48 | "Name" : { "Fn::Join" : [ "", [{"Ref" : "AWS::StackId"}, ".", {"Ref" : "AWS::Region"}, ".", { "Ref" : "HostedZone" }]]}, 49 | "Type" : "CNAME", 50 | "TTL" : "900", 51 | "ResourceRecords" : [{ "Fn::Join" : [ "", ["http://", {"Fn::GetAtt" : ["WebsiteCDN", "DomainName"]} ]]}] 52 | } 53 | } 54 | }, 55 | 56 | "Outputs" : { 57 | "WebsiteURL" : { 58 | "Value" : {"Fn::Join" : [ "", ["http://", {"Ref" : "WebsiteDNSName"} ]] }, 59 | "Description" : "The URL of the newly created website" 60 | }, 61 | "BucketName" : { 62 | "Value" : { "Ref" : "S3BucketForWebsiteContent" }, 63 | "Description" : "Name of S3 bucket to hold website content" 64 | } 65 | } 66 | } 67 | -------------------------------------------------------------------------------- /S3_With_CloudFront_Distribution.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template S3_With_CloudFront_Distribution: Sample template showing how to create a website with a custom DNS name, hosted on Amazon S3 and served via Amazone CloudFront. It assumes you already have a Hosted Zone registered with Amazon Route 53. **WARNING** This template creates an Amazon Route 53 DNS record, an S3 bucket and a CloudFront distribution. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "HostedZone" : { 8 | "Type" : "String", 9 | "Description" : "The DNS name of an existing Amazon Route 53 hosted zone" 10 | } 11 | }, 12 | 13 | "Mappings" : { 14 | "RegionMap" : { 15 | "us-east-1" : { "s3BucketDomain" : ".s3.amazonaws.com" }, 16 | "us-west-1" : { "s3BucketDomain" : ".s3-us-west-1.amazonaws.com" }, 17 | "us-west-2" : { "s3BucketDomain" : ".s3-us-west-2.amazonaws.com" }, 18 | "eu-west-1" : { "s3BucketDomain" : ".s3-eu-west-1.amazonaws.com" }, 19 | "sa-east-1" : { "s3BucketDomain" : ".s3-sa-east-1.amazonaws.com" }, 20 | "ap-northeast-1" : { "s3BucketDomain" : ".s3-ap-northeast-1.amazonaws.com" }, 21 | "ap-southeast-1" : { "s3BucketDomain" : ".s3-ap-southeast-1.amazonaws.com" }, 22 | "ap-southeast-2" : { "s3BucketDomain" : ".s3-ap-southeast-2.amazonaws.com" } 23 | } 24 | }, 25 | 26 | "Resources" : { 27 | "S3BucketForWebsiteContent" : { 28 | "Type" : "AWS::S3::Bucket", 29 | "Properties" : { 30 | } 31 | }, 32 | 33 | "WebsiteCDN" : { 34 | "Type" : "AWS::CloudFront::Distribution", 35 | "Properties" : { 36 | "DistributionConfig" : { 37 | "Comment" : "CDN for S3-backed website", 38 | "CustomOrigin" : { 39 | "DNSName": { "Fn::Join" : ["", [{"Ref" : "S3BucketForWebsiteContent"}, { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "s3BucketDomain" ]} ]]}, 40 | "HTTPPort" : "80", 41 | "HTTPSPort" : "443", 42 | "OriginProtocolPolicy" : "http-only" 43 | }, 44 | "Enabled" : "true", 45 | "DefaultRootObject" : "index.html", 46 | "CNAMEs" : [{ "Fn::Join" : [ "", [{"Ref" : "AWS::StackId"}, ".", {"Ref" : "AWS::Region"}, ".", { "Ref" : "HostedZone" }]]}] 47 | } 48 | } 49 | }, 50 | 51 | "WebsiteDNSName" : { 52 | "Type" : "AWS::Route53::RecordSet", 53 | "Properties" : { 54 | "HostedZoneName" : { "Fn::Join" : [ "", [{ "Ref" : "HostedZone" }, "."]]}, 55 | "Comment" : "CNAME redirect custom name to CloudFront distribution", 56 | "Name" : { "Fn::Join" : [ "", [{"Ref" : "AWS::StackId"}, ".", {"Ref" : "AWS::Region"}, ".", { "Ref" : "HostedZone" }]]}, 57 | "Type" : "CNAME", 58 | "TTL" : "900", 59 | "ResourceRecords" : [{ "Fn::Join" : [ "", ["http://", {"Fn::GetAtt" : ["WebsiteCDN", "DomainName"]} ]]}] 60 | } 61 | } 62 | }, 63 | 64 | "Outputs" : { 65 | "WebsiteURL" : { 66 | "Value" : {"Fn::Join" : [ "", ["http://", {"Ref" : "WebsiteDNSName"} ]] }, 67 | "Description" : "The URL of the newly created website" 68 | }, 69 | "BucketName" : { 70 | "Value" : { "Ref" : "S3BucketForWebsiteContent" }, 71 | "Description" : "Name of S3 bucket to hold website content" 72 | } 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /SQS.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template SQS: Sample template showing how to create an SQS queue. **WARNING** This template creates an Amazon SQS Queue. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Resources" : { 7 | "MyQueue" : { 8 | "Type" : "AWS::SQS::Queue" 9 | } 10 | }, 11 | "Outputs" : { 12 | "QueueURL" : { 13 | "Description" : "URL of newly created SQS Queue", 14 | "Value" : { "Ref" : "MyQueue" } 15 | }, 16 | "QueueARN" : { 17 | "Description" : "ARN of newly created SQS Queue", 18 | "Value" : { "Fn::GetAtt" : ["MyQueue", "Arn"]} 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /SQSWithQueueName.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion": "2010-09-09", 3 | 4 | "Description": "AWS CloudFormation Sample Template SQSWithQueueName: Sample template showing how to create an SQS queue with a specific name. **WARNING** This template creates an Amazon SQS Queue. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "QueueName" : { 8 | "Description" : "Name of queue to create", 9 | "Type" : "String", 10 | "MinLength": "1", 11 | "MaxLength": "80", 12 | "AllowedPattern": "[a-zA-Z0-9_-]+", 13 | "ConstraintDescription": "must be a valid queue name." 14 | } 15 | }, 16 | 17 | "Resources": { 18 | "MyQueue": { 19 | "Type": "AWS::SQS::Queue", 20 | "Properties" : { 21 | "QueueName" : { "Ref" : "QueueName" } 22 | } 23 | } 24 | }, 25 | 26 | "Outputs": { 27 | "QueueURL": { 28 | "Description": "URL of newly created SQS Queue", 29 | "Value": { "Ref": "MyQueue" } 30 | }, 31 | "QueueARN": { 32 | "Description": "ARN of newly created SQS Queue", 33 | "Value": { "Fn::GetAtt": [ "MyQueue", "Arn" ] } 34 | } 35 | } 36 | 37 | } 38 | -------------------------------------------------------------------------------- /SQS_With_CloudWatch_Alarms.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template SQS_With_CloudWatch_Alarms: Sample template showing how to create an SQS queue with AWS CloudWatch alarms on queue depth. **WARNING** This template creates an Amazon SQS Queue and one or more Amazon CloudWatch alarms. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "AlarmEmail": { 8 | "Default": "nobody@amazon.com", 9 | "Description": "Email address to notify if there are any operational issues", 10 | "Type": "String" 11 | } 12 | }, 13 | 14 | "Resources" : { 15 | "MyQueue" : { 16 | "Type" : "AWS::SQS::Queue", 17 | "Properties" : { 18 | } 19 | }, 20 | "AlarmTopic": { 21 | "Type": "AWS::SNS::Topic", 22 | "Properties": { 23 | "Subscription": [{ 24 | "Endpoint": { "Ref": "AlarmEmail" }, 25 | "Protocol": "email" 26 | }] 27 | } 28 | }, 29 | "QueueDepthAlarm": { 30 | "Type": "AWS::CloudWatch::Alarm", 31 | "Properties": { 32 | "AlarmDescription": "Alarm if queue depth grows beyond 10 messages", 33 | "Namespace": "AWS/SQS", 34 | "MetricName": "ApproximateNumberOfMessagesVisible", 35 | "Dimensions": [{ 36 | "Name": "QueueName", 37 | "Value" : { "Fn::GetAtt" : ["MyQueue", "QueueName"] } 38 | }], 39 | "Statistic": "Sum", 40 | "Period": "300", 41 | "EvaluationPeriods": "1", 42 | "Threshold": "10", 43 | "ComparisonOperator": "GreaterThanThreshold", 44 | "AlarmActions": [{ 45 | "Ref": "AlarmTopic" 46 | }], 47 | "InsufficientDataActions": [{ 48 | "Ref": "AlarmTopic" 49 | }] 50 | } 51 | } 52 | }, 53 | "Outputs" : { 54 | "QueueURL" : { 55 | "Description" : "URL of newly created SQS Queue", 56 | "Value" : { "Ref" : "MyQueue" } 57 | }, 58 | "QueueARN" : { 59 | "Description" : "ARN of newly created SQS Queue", 60 | "Value" : { "Fn::GetAtt" : ["MyQueue", "Arn"]} 61 | }, 62 | "QueueName" : { 63 | "Description" : "Name newly created SQS Queue", 64 | "Value" : { "Fn::GetAtt" : ["MyQueue", "QueueName"]} 65 | } 66 | } 67 | } 68 | 69 | -------------------------------------------------------------------------------- /SampleRailsApp.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template SampleRailsApp: This sample template shows how to use AWS CloudFormation with the Amazon Linux AMI Cloud-init feature to instantiate an application at runtime. The sample uses the WaitCondition resource to synchronize creation of the stack with the application becoming healthy. **WARNING** This template creates an Amazon EC2 instance and an Elastic IP Address. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "KeyName" : { 8 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the instance", 9 | "Type" : "String" 10 | }, 11 | "SSHLocation" : { 12 | "Description" : " The IP address range that can be used to SSH to the EC2 instances", 13 | "Type": "String", 14 | "MinLength": "9", 15 | "MaxLength": "18", 16 | "Default": "0.0.0.0/0", 17 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 18 | "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x." 19 | } 20 | }, 21 | 22 | "Mappings" : { 23 | "RegionMap" : { 24 | "us-east-1" : { "AMI" : "ami-7f418316" }, 25 | "us-west-1" : { "AMI" : "ami-951945d0" }, 26 | "us-west-2" : { "AMI" : "ami-16fd7026" }, 27 | "eu-west-1" : { "AMI" : "ami-24506250" }, 28 | "sa-east-1" : { "AMI" : "ami-3e3be423" }, 29 | "ap-southeast-1" : { "AMI" : "ami-74dda626" }, 30 | "ap-southeast-2" : { "AMI" : "ami-b3990e89" }, 31 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" } 32 | } 33 | }, 34 | 35 | "Resources" : { 36 | "Ec2Instance" : { 37 | "Type" : "AWS::EC2::Instance", 38 | "Properties" : { 39 | "KeyName" : { "Ref" : "KeyName" }, 40 | "SecurityGroups" : [ { "Ref" : "InstanceSecurityGroup" } ], 41 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, 42 | "UserData" : { "Fn::Base64" : { "Fn::Join" : ["",[ 43 | "#!/bin/bash -ex","\n", 44 | "yum -y install gcc-c++ make","\n", 45 | "yum -y install mysql-devel sqlite-devel","\n", 46 | "yum -y install ruby-rdoc rubygems ruby-mysql ruby-devel","\n", 47 | "gem install --no-ri --no-rdoc rails","\n", 48 | "gem install --no-ri --no-rdoc mysql","\n", 49 | "gem install --no-ri --no-rdoc sqlite3","\n", 50 | "rails new myapp","\n", 51 | "cd myapp","\n", 52 | "rails server -d","\n", 53 | "curl -X PUT -H 'Content-Type:' --data-binary '{\"Status\" : \"SUCCESS\",", 54 | "\"Reason\" : \"The application myapp is ready\",", 55 | "\"UniqueId\" : \"myapp\",", 56 | "\"Data\" : \"Done\"}' ", 57 | "\"", {"Ref" : "WaitForInstanceWaitHandle"},"\"\n" ]]}} 58 | } 59 | }, 60 | 61 | "InstanceSecurityGroup" : { 62 | "Type" : "AWS::EC2::SecurityGroup", 63 | "Properties" : { 64 | "GroupDescription" : "Enable Access to Rails application via port 3000 and SSH access via port 22", 65 | "SecurityGroupIngress" : [ 66 | {"IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation"}}, 67 | {"IpProtocol" : "tcp", "FromPort" : "3000", "ToPort" : "3000", "CidrIp" : "0.0.0.0/0"} 68 | ] 69 | } 70 | }, 71 | 72 | "WaitForInstanceWaitHandle" : { 73 | "Type" : "AWS::CloudFormation::WaitConditionHandle", 74 | "Properties" : { 75 | } 76 | }, 77 | 78 | "WaitForInstance" : { 79 | "Type" : "AWS::CloudFormation::WaitCondition", 80 | "DependsOn" : "Ec2Instance", 81 | "Properties" : { 82 | "Handle" : {"Ref" : "WaitForInstanceWaitHandle"}, 83 | "Timeout" : "600" 84 | } 85 | } 86 | }, 87 | 88 | "Outputs" : { 89 | "WebsiteURL" : { 90 | "Description" : "The URL for the newly created Rails application", 91 | "Value" : { "Fn::Join" : ["", [ "http://", { "Fn::GetAtt" : [ "Ec2Instance", "PublicDnsName" ] }, ":3000" ]]} 92 | } 93 | } 94 | } 95 | 96 | -------------------------------------------------------------------------------- /Templates_within_Templates.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion": "2010-09-09", 3 | 4 | "Description": "AWS CloudFormation Sample Template Templates_within_Templates: This template demonstrates using embedded templates to build an end to end solution from basic building blocks. It builds a PHP Hello World sample application that connects to an Amazon Relational Database Service database instance and displays information about the web server. **WARNING** This template creates one or more Amazon EC2 instances and CloudWatch alarms. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters": { 7 | "KeyName": { 8 | "Type": "String", 9 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the web server" 10 | }, 11 | "InstanceType" : { 12 | "Description" : "WebServer EC2 instance type", 13 | "Type" : "String", 14 | "Default" : "m1.small", 15 | "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"], 16 | "ConstraintDescription" : "must be a valid EC2 instance type." 17 | }, 18 | "DatabaseType": { 19 | "Default": "db.m1.small", 20 | "Description" : "The database instance type", 21 | "Type": "String", 22 | "AllowedValues" : [ "db.m1.small", "db.m1.large", "db.m1.xlarge", "db.m2.xlarge", "db.m2.2xlarge", "db.m2.4xlarge" ], 23 | "ConstraintDescription" : "must be a valid RDS DB Instance type." 24 | }, 25 | "DatabaseUser": { 26 | "NoEcho": "true", 27 | "Type": "String", 28 | "Description" : "Test database admin account name", 29 | "MinLength": "1", 30 | "MaxLength": "16", 31 | "AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*", 32 | "ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters." 33 | }, 34 | "DatabasePassword": { 35 | "NoEcho": "true", 36 | "Type": "String", 37 | "Description" : "Test database admin account password", 38 | "MinLength": "1", 39 | "MaxLength": "41", 40 | "AllowedPattern" : "[a-zA-Z0-9]*", 41 | "ConstraintDescription" : "must contain only alphanumeric characters." 42 | }, 43 | "OperatorEmail": { 44 | "Description": "EMail address to notify if there are operational issues", 45 | "Type": "String" 46 | }, 47 | "SSHLocation" : { 48 | "Description" : " The IP address range that can be used to SSH to the EC2 instances", 49 | "Type": "String", 50 | "MinLength": "9", 51 | "MaxLength": "18", 52 | "Default": "0.0.0.0/0", 53 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 54 | "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x." 55 | } 56 | }, 57 | 58 | "Mappings" : { 59 | "RegionMap" : { 60 | "us-east-1" : { "s3Bucket" : "https://s3.amazonaws.com/@@@CFN_TEMPLATES_USEAST1_DIR@@@" }, 61 | "us-west-1" : { "s3Bucket" : "https://s3.amazonaws.com/cloudformation-templates-us-west-1" }, 62 | "us-west-2" : { "s3Bucket" : "https://s3.amazonaws.com/cloudformation-templates-us-west-2" }, 63 | "eu-west-1" : { "s3Bucket" : "https://s3.amazonaws.com/cloudformation-templates-eu-west-1" }, 64 | "sa-east-1" : { "s3Bucket" : "https://s3.amazonaws.com/cloudformation-templates-sa-east-1" }, 65 | "ap-northeast-1" : { "s3Bucket" : "https://s3.amazonaws.com/cloudformation-templates-ap-northeast-1" }, 66 | "ap-southeast-1" : { "s3Bucket" : "https://s3.amazonaws.com/cloudformation-templates-ap-southeast-1" }, 67 | "ap-southeast-2" : { "s3Bucket" : "https://s3.amazonaws.com/cloudformation-templates-ap-southeast-2" } 68 | } 69 | }, 70 | 71 | "Resources" : { 72 | 73 | "AlarmTopic" : { 74 | "Type" : "AWS::SNS::Topic", 75 | "Properties" : { 76 | "Subscription" : [ { 77 | "Endpoint" : { "Ref": "OperatorEmail" }, 78 | "Protocol" : "email" 79 | } ] 80 | } 81 | }, 82 | 83 | "EC2SecurityGroup" : { 84 | "Type" : "AWS::EC2::SecurityGroup", 85 | "Properties" : { 86 | "GroupDescription" : "Open up SSH access", 87 | "SecurityGroupIngress" : [ { 88 | "IpProtocol": "tcp", 89 | "FromPort": "22", 90 | "ToPort": "22", 91 | "CidrIp": { "Ref" : "SSHLocation"} 92 | } ] 93 | } 94 | }, 95 | 96 | "WebServer" : { 97 | "Type" : "AWS::CloudFormation::Stack", 98 | "Metadata" : { 99 | "Comment" : "Create web server farm attached to database." 100 | }, 101 | "Properties" : { 102 | "TemplateURL" : { "Fn::Join" : ["/", [{ "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "s3Bucket" ]}, 103 | "PHP_Database_Application.template" ]]}, 104 | "Parameters" : { 105 | "KeyName" : { "Ref" : "KeyName" }, 106 | "InstanceType" : { "Ref" : "InstanceType"}, 107 | "EC2SecurityGroup" : { "Ref" : "EC2SecurityGroup" }, 108 | "AlarmTopic" : { "Ref" : "AlarmTopic" }, 109 | "WebServerPort" : "8888", 110 | "DatabaseUser" : { "Ref" : "DatabaseUser" }, 111 | "DatabasePassword" : { "Ref" : "DatabasePassword" }, 112 | "DatabaseEndpoint" : { "Fn::GetAtt" : [ "AppDatabase", "Outputs.DBAddress" ] }, 113 | "DatabasePort" : { "Fn::GetAtt" : [ "AppDatabase", "Outputs.DBPort" ] } 114 | } 115 | } 116 | }, 117 | 118 | "AppDatabase" : { 119 | "Type" : "AWS::CloudFormation::Stack", 120 | "Metadata" : { 121 | "Comment" : "Application database." 122 | }, 123 | "Properties" : { 124 | "TemplateURL" : { "Fn::Join" : ["/", [{ "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "s3Bucket" ]}, 125 | "RDS_MySQL_55.template" ]]}, 126 | "Parameters" : { 127 | "DBUser" : { "Ref" : "DatabaseUser" }, 128 | "DBPassword" : { "Ref" : "DatabasePassword" }, 129 | "DBInstanceClass" : { "Ref" : "DatabaseType" }, 130 | "AlarmTopic" : { "Ref" : "AlarmTopic" }, 131 | "EC2SecurityGroup" : { "Ref" : "EC2SecurityGroup" } 132 | } 133 | } 134 | } 135 | }, 136 | 137 | "Outputs": { 138 | "URL": { 139 | "Value": { "Fn::GetAtt": [ "WebServer", "Outputs.URL" ] }, 140 | "Description" : "URL of the website" 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /VPC_EC2_Instance_With_Multiple_Dynamic_IPAddresses.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template VPC_EC2_Instance_With_Multiple_Static_IPAddresses.template: Sample template showing how to create an instance with a single network interface and multiple IP addresses (via DHCP) in an existing VPC. It assumes you have already created a VPC. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | 8 | "KeyName" : { 9 | "Description" : "Name of and existing EC2 KeyPair to enable SSH access to the instance", 10 | "Type" : "String" 11 | }, 12 | 13 | "VpcId" : { 14 | "Type" : "String", 15 | "Description" : "VpcId of your existing Virtual Private Cloud (VPC)" 16 | }, 17 | 18 | "SubnetId" : { 19 | "Type" : "String", 20 | "Description" : "SubnetId of an existing subnet (for the primary network) in your Virtual Private Cloud (VPC)" 21 | }, 22 | 23 | "SecondaryIPAddressCount" : { 24 | "Type" : "Number", 25 | "Default" : "1", 26 | "MinValue" : "1", 27 | "MaxValue" : "5", 28 | "Description" : "Number of secondary IP addresses to assign to the network interface (1-5)", 29 | "ConstraintDescription": "must be a number from 1 to 5." 30 | }, 31 | 32 | "SSHLocation" : { 33 | "Description" : "The IP address range that can be used to SSH to the EC2 instances", 34 | "Type": "String", 35 | "MinLength": "9", 36 | "MaxLength": "18", 37 | "Default": "0.0.0.0/0", 38 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 39 | "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x." 40 | } 41 | }, 42 | 43 | "Mappings" : { 44 | "RegionMap" : { 45 | "us-east-1" : { "AMI" : "ami-7f418316" }, 46 | "us-west-1" : { "AMI" : "ami-951945d0" }, 47 | "us-west-2" : { "AMI" : "ami-16fd7026" }, 48 | "eu-west-1" : { "AMI" : "ami-24506250" }, 49 | "sa-east-1" : { "AMI" : "ami-3e3be423" }, 50 | "ap-southeast-1" : { "AMI" : "ami-74dda626" }, 51 | "ap-southeast-2" : { "AMI" : "ami-b3990e89" }, 52 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" } 53 | } 54 | }, 55 | 56 | "Resources" : { 57 | 58 | "EIP1" : { 59 | "Type" : "AWS::EC2::EIP", 60 | "Properties" : { 61 | "Domain" : "vpc" 62 | } 63 | }, 64 | 65 | "EIPAssoc1" : { 66 | "Type" : "AWS::EC2::EIPAssociation", 67 | "Properties" : { 68 | "NetworkInterfaceId" : { "Ref" : "Eth0" }, 69 | "AllocationId" : { "Fn::GetAtt" : ["EIP1", "AllocationId"] }, 70 | "PrivateIpAddress" : { "Fn::GetAtt" : ["Eth0", "PrimaryPrivateIpAddress" ] } 71 | } 72 | }, 73 | 74 | "SSHSecurityGroup" : { 75 | "Type" : "AWS::EC2::SecurityGroup", 76 | "Properties" : { 77 | "VpcId" : { "Ref" : "VpcId" }, 78 | "GroupDescription" : "Enable SSH access via port 22", 79 | "SecurityGroupIngress" : [ {"IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation"}} ] 80 | } 81 | }, 82 | 83 | "EC2Instance" : { 84 | "Type" : "AWS::EC2::Instance", 85 | "Properties" : { 86 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, 87 | "KeyName" : { "Ref" : "KeyName" }, 88 | "NetworkInterfaces" : [ 89 | { "NetworkInterfaceId" : {"Ref" : "Eth0" }, "DeviceIndex" : "0" }], 90 | "Tags" : [ {"Key" : "Name", "Value" : "MyInstance" } ] 91 | } 92 | }, 93 | 94 | "Eth0" : { 95 | "Type" : "AWS::EC2::NetworkInterface", 96 | "Properties" : { 97 | "Description" : "eth0", 98 | "GroupSet" : [ { "Ref" : "SSHSecurityGroup" } ], 99 | "SourceDestCheck" : "true", 100 | "SubnetId" : { "Ref" : "SubnetId" }, 101 | "Tags" : [ {"Key" : "Name", "Value" : "Interface 0"}, {"Key" : "Interface", "Value" : "eth0"} ], 102 | "SecondaryPrivateIpAddressCount" : { "Ref" : "SecondaryIPAddressCount" } 103 | } 104 | } 105 | }, 106 | 107 | "Outputs" : { 108 | "InstanceId" : { 109 | "Value" : { "Ref" : "EC2Instance" }, 110 | "Description" : "Instance Id of newly created instance" 111 | }, 112 | "EIP1" : { 113 | "Value" : { "Fn::Join" : [" ", [ "IP address", { "Ref" : "EIP1" }, "on subnet", {"Ref" : "SubnetId"}]]}, 114 | "Description" : "Primary public IP address for Eth0" 115 | }, 116 | "PrimaryPrivateIPAddress" : { 117 | "Value" : { "Fn::Join" : [" ", [ "IP address", { "Fn::GetAtt" : ["Eth0", "PrimaryPrivateIpAddress"] }, "on subnet", {"Ref" : "SubnetId"}]]}, 118 | "Description" : "Primary private IP address of Eth0" 119 | }, 120 | "FirstSecondaryPrivateIPAddress" : { 121 | "Value" : { "Fn::Join" : [" ", [ "IP address", { "Fn::Select" : [ "0", { "Fn::GetAtt" : ["Eth0", "SecondaryPrivateIpAddresses"] }]}, "on subnet", {"Ref" : "SubnetId"}]]}, 122 | "Description" : "First secondary private IP address of Eth0" 123 | } 124 | } 125 | } 126 | -------------------------------------------------------------------------------- /VPC_EC2_Instance_With_Multiple_Static_IPAddresses.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template VPC_EC2_Instance_With_Multiple_Static_IPAddresses.template: Sample template showing how to create an instance with a single network interface and multiple static IP addresses in an existing VPC. It assumes you have already created a VPC. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | 8 | "KeyName" : { 9 | "Description" : "Name of and existing EC2 KeyPair to enable SSH access to the instance", 10 | "Type" : "String" 11 | }, 12 | 13 | "VpcId" : { 14 | "Type" : "String", 15 | "Description" : "VpcId of your existing Virtual Private Cloud (VPC)" 16 | }, 17 | 18 | "SubnetId" : { 19 | "Type" : "String", 20 | "Description" : "SubnetId of an existing subnet (for the primary network) in your Virtual Private Cloud (VPC)" 21 | }, 22 | 23 | "PrimaryIPAddress" : { 24 | "Type" : "String", 25 | "Description" : "Primary private IP. This must be a valid IP address for Subnet" 26 | }, 27 | 28 | "SecondaryIPAddress" : { 29 | "Type" : "String", 30 | "Description" : "Secondary private IP. This must be a valid IP address for Subnet" 31 | }, 32 | 33 | "SSHLocation" : { 34 | "Description" : "The IP address range that can be used to SSH to the EC2 instances", 35 | "Type": "String", 36 | "MinLength": "9", 37 | "MaxLength": "18", 38 | "Default": "0.0.0.0/0", 39 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 40 | "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x." 41 | } 42 | }, 43 | 44 | "Mappings" : { 45 | "RegionMap" : { 46 | "us-east-1" : { "AMI" : "ami-7f418316" }, 47 | "us-west-1" : { "AMI" : "ami-951945d0" }, 48 | "us-west-2" : { "AMI" : "ami-16fd7026" }, 49 | "eu-west-1" : { "AMI" : "ami-24506250" }, 50 | "sa-east-1" : { "AMI" : "ami-3e3be423" }, 51 | "ap-southeast-1" : { "AMI" : "ami-74dda626" }, 52 | "ap-southeast-2" : { "AMI" : "ami-b3990e89" }, 53 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" } 54 | } 55 | }, 56 | 57 | "Resources" : { 58 | 59 | "EIP1" : { 60 | "Type" : "AWS::EC2::EIP", 61 | "Properties" : { 62 | "Domain" : "vpc" 63 | } 64 | }, 65 | 66 | "EIPAssoc1" : { 67 | "Type" : "AWS::EC2::EIPAssociation", 68 | "Properties" : { 69 | "NetworkInterfaceId" : { "Ref" : "Eth0" }, 70 | "AllocationId" : { "Fn::GetAtt" : ["EIP1", "AllocationId"] } 71 | } 72 | }, 73 | 74 | "SSHSecurityGroup" : { 75 | "Type" : "AWS::EC2::SecurityGroup", 76 | "Properties" : { 77 | "VpcId" : { "Ref" : "VpcId" }, 78 | "GroupDescription" : "Enable SSH access via port 22", 79 | "SecurityGroupIngress" : [ {"IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation"}} ] 80 | } 81 | }, 82 | 83 | "EC2Instance" : { 84 | "Type" : "AWS::EC2::Instance", 85 | "Properties" : { 86 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, 87 | "KeyName" : { "Ref" : "KeyName" }, 88 | "NetworkInterfaces" : [ 89 | { "NetworkInterfaceId" : {"Ref" : "Eth0" }, "DeviceIndex" : "0" }], 90 | "Tags" : [ {"Key" : "Name", "Value" : "MyInstance" } ] 91 | } 92 | }, 93 | 94 | "Eth0" : { 95 | "Type" : "AWS::EC2::NetworkInterface", 96 | "Properties" : { 97 | "Description" : "eth0", 98 | "GroupSet" : [ { "Ref" : "SSHSecurityGroup" } ], 99 | "PrivateIpAddresses" : [ 100 | { "PrivateIpAddress" : { "Ref" : "PrimaryIPAddress" }, "Primary" : "true" }, 101 | { "PrivateIpAddress" : { "Ref" : "SecondaryIPAddress" }, "Primary" : "false" } 102 | ], 103 | "SourceDestCheck" : "true", 104 | "SubnetId" : { "Ref" : "SubnetId" }, 105 | "Tags" : [ {"Key" : "Name", "Value" : "Interface 0"}, {"Key" : "Interface", "Value" : "eth0"} ] 106 | } 107 | } 108 | }, 109 | 110 | "Outputs" : { 111 | "InstanceId" : { 112 | "Value" : { "Ref" : "EC2Instance" }, 113 | "Description" : "Instance Id of newly created instance" 114 | }, 115 | "EIP1" : { 116 | "Value" : { "Fn::Join" : [" ", [ "IP address", { "Ref" : "EIP1" }, "on subnet", {"Ref" : "SubnetId"}]]}, 117 | "Description" : "Primary public IP of Eth0" 118 | }, 119 | "PrimaryPrivateIPAddress" : { 120 | "Value" : { "Fn::Join" : [" ", [ "IP address", { "Fn::GetAtt" : ["Eth0", "PrimaryPrivateIpAddress"] }, "on subnet", {"Ref" : "SubnetId"}]]}, 121 | "Description" : "Primary private IP address of Eth0" 122 | }, 123 | "SecondaryPrivateIPAddresses" : { 124 | "Value" : { "Fn::Join" : [" ", [ "IP address", { "Fn::Select" : [ "0", { "Fn::GetAtt" : ["Eth0", "SecondaryPrivateIpAddresses"] }]}, "on subnet", {"Ref" : "SubnetId"}]]}, 125 | "Description" : "Secondary private IP address of Eth0" 126 | } 127 | } 128 | } 129 | -------------------------------------------------------------------------------- /VPC_EC2_Instance_with_EIP_and_Security_Group.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template VPC_EC2_Instance_with_EIP_and_Security_Group: Sample template showing how to create an instance with an Elastic IP address and a security group in an existing VPC. It assumes you have already created a VPC. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | 8 | "KeyName" : { 9 | "Description" : "Name of and existing EC2 KeyPair to enable SSH access to the instance", 10 | "Type" : "String" 11 | }, 12 | 13 | "VpcId" : { 14 | "Type" : "String", 15 | "Description" : "VpcId of your existing Virtual Private Cloud (VPC)" 16 | }, 17 | 18 | "SubnetId" : { 19 | "Type" : "String", 20 | "Description" : "SubnetId of an existing subnet in your Virtual Private Cloud (VPC)" 21 | }, 22 | "SSHLocation" : { 23 | "Description" : " The IP address range that can be used to SSH to the EC2 instances", 24 | "Type": "String", 25 | "MinLength": "9", 26 | "MaxLength": "18", 27 | "Default": "0.0.0.0/0", 28 | "AllowedPattern": "(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})\\.(\\d{1,3})/(\\d{1,2})", 29 | "ConstraintDescription": "must be a valid IP CIDR range of the form x.x.x.x/x." 30 | } 31 | }, 32 | 33 | "Mappings" : { 34 | "RegionMap" : { 35 | "us-east-1" : { "AMI" : "ami-7f418316" }, 36 | "us-west-1" : { "AMI" : "ami-951945d0" }, 37 | "us-west-2" : { "AMI" : "ami-16fd7026" }, 38 | "eu-west-1" : { "AMI" : "ami-24506250" }, 39 | "sa-east-1" : { "AMI" : "ami-3e3be423" }, 40 | "ap-southeast-1" : { "AMI" : "ami-74dda626" }, 41 | "ap-southeast-2" : { "AMI" : "ami-b3990e89" }, 42 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" } 43 | } 44 | }, 45 | 46 | "Resources" : { 47 | 48 | "IPAddress" : { 49 | "Type" : "AWS::EC2::EIP", 50 | "Properties" : { 51 | "Domain" : "vpc", 52 | "InstanceId" : { "Ref" : "Ec2Instance" } 53 | } 54 | }, 55 | 56 | "InstanceSecurityGroup" : { 57 | "Type" : "AWS::EC2::SecurityGroup", 58 | "Properties" : { 59 | "VpcId" : { "Ref" : "VpcId" }, 60 | "GroupDescription" : "Enable SSH access via port 22", 61 | "SecurityGroupIngress" : [ {"IpProtocol" : "tcp", "FromPort" : "22", "ToPort" : "22", "CidrIp" : { "Ref" : "SSHLocation"}} ] 62 | } 63 | }, 64 | 65 | "Ec2Instance" : { 66 | "Type" : "AWS::EC2::Instance", 67 | "Properties" : { 68 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, 69 | "SecurityGroupIds" : [{ "Ref" : "InstanceSecurityGroup" }], 70 | "SubnetId" : { "Ref" : "SubnetId" }, 71 | "KeyName" : { "Ref" : "KeyName" } 72 | } 73 | } 74 | }, 75 | 76 | "Outputs" : { 77 | "InstanceId" : { 78 | "Value" : { "Ref" : "Ec2Instance" }, 79 | "Description" : "Instance Id of newly created instance" 80 | }, 81 | 82 | "IPAddress" : { 83 | "Value" : { "Ref" : "IPAddress" }, 84 | "Description" : "Public IP address of instance" 85 | } 86 | } 87 | } 88 | -------------------------------------------------------------------------------- /VPC_Instance_With_Association.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template VPC_Instance_With_Association: Sample template showing how to create an instance in a VPC and associate is with an existing VPC-based Elastic IP Address and VPC-based security group. It assumes you already have a VPC with an EIP and a Security Group associated with the VPC. **WARNING** This template creates an Amazon EC2 instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | "AllocationId" : { 8 | "Type" : "String", 9 | "Description" : "AllocationId of existing Elastic IP (EIP) in your Virtual Private Cloud (VPC)" 10 | }, 11 | "SubnetId" : { 12 | "Type" : "String", 13 | "Description" : "SubnetId of an existing subnet in your Virtual Private Cloud (VPC)" 14 | }, 15 | "SecurityGroupId" : { 16 | "Type" : "String", 17 | "Description" : "The SecurityGroupId of an existing EC2 SecurityGroup in your Virtual Private Cloud (VPC)" 18 | } 19 | }, 20 | 21 | "Mappings" : { 22 | "RegionMap" : { 23 | "us-east-1" : { "AMI" : "ami-7f418316" }, 24 | "us-west-1" : { "AMI" : "ami-951945d0" }, 25 | "us-west-2" : { "AMI" : "ami-16fd7026" }, 26 | "eu-west-1" : { "AMI" : "ami-24506250" }, 27 | "sa-east-1" : { "AMI" : "ami-3e3be423" }, 28 | "ap-southeast-1" : { "AMI" : "ami-74dda626" }, 29 | "ap-southeast-2" : { "AMI" : "ami-b3990e89" }, 30 | "ap-northeast-1" : { "AMI" : "ami-dcfa4edd" } 31 | } 32 | }, 33 | 34 | "Resources" : { 35 | "Ec2Instance" : { 36 | "Type" : "AWS::EC2::Instance", 37 | "Properties" : { 38 | "ImageId" : { "Fn::FindInMap" : [ "RegionMap", { "Ref" : "AWS::Region" }, "AMI" ]}, 39 | "SecurityGroupIds" : [{ "Ref" : "SecurityGroupId" }], 40 | "SubnetId" : { "Ref" : "SubnetId" } 41 | } 42 | }, 43 | "IPAssoc" : { 44 | "Type" : "AWS::EC2::EIPAssociation", 45 | "Properties" : { 46 | "InstanceId" : { "Ref" : "Ec2Instance" }, 47 | "AllocationId" : { "Ref" : "AllocationId" } 48 | } 49 | } 50 | }, 51 | "Outputs" : { 52 | "InstanceId" : { 53 | "Value" : { "Ref" : "Ec2Instance" }, 54 | "Description" : "Instance Id of newly created instance" 55 | }, 56 | "InstanceIPAddress" : { 57 | "Value" : { "Fn::GetAtt" : ["Ec2Instance", "PublicIp"] }, 58 | "Description" : "Public IP address of instance" 59 | } 60 | } 61 | } 62 | -------------------------------------------------------------------------------- /VPC_RDS_DB_Instance.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "AWS CloudFormation Sample Template VPC_RDS_DB_Instance: Sample template showing how to create an RDS DBInstance in an existing Virtual Private Cloud (VPC). **WARNING** This template creates an Amazon Relational Database Service database instance. You will be billed for the AWS resources used if you create a stack from this template.", 5 | 6 | "Parameters" : { 7 | 8 | "VpcId" : { 9 | "Type" : "String", 10 | "Description" : "VpcId of your existing Virtual Private Cloud (VPC)" 11 | }, 12 | 13 | "Subnets" : { 14 | "Type" : "CommaDelimitedList", 15 | "Description" : "The list of SubnetIds, one in each Availability Zone in the region in your Virtual Private Cloud (VPC)" 16 | }, 17 | 18 | "DBName": { 19 | "Default": "MyDatabase", 20 | "Description" : "The database name", 21 | "Type": "String", 22 | "MinLength": "1", 23 | "MaxLength": "64", 24 | "AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*", 25 | "ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters." 26 | }, 27 | 28 | "DBUsername": { 29 | "Default": "admin", 30 | "NoEcho": "true", 31 | "Description" : "The database admin account username", 32 | "Type": "String", 33 | "MinLength": "1", 34 | "MaxLength": "16", 35 | "AllowedPattern" : "[a-zA-Z][a-zA-Z0-9]*", 36 | "ConstraintDescription" : "must begin with a letter and contain only alphanumeric characters." 37 | }, 38 | 39 | "DBPassword": { 40 | "Default": "password", 41 | "NoEcho": "true", 42 | "Description" : "The database admin account password", 43 | "Type": "String", 44 | "MinLength": "8", 45 | "MaxLength": "41", 46 | "AllowedPattern" : "[a-zA-Z0-9]*", 47 | "ConstraintDescription" : "must contain only alphanumeric characters." 48 | }, 49 | 50 | "DBClass" : { 51 | "Default" : "db.m1.small", 52 | "Description" : "Database instance class", 53 | "Type" : "String", 54 | "AllowedValues" : [ "db.m1.small", "db.m1.large", "db.m1.xlarge", "db.m2.xlarge", "db.m2.2xlarge", "db.m2.4xlarge" ], 55 | "ConstraintDescription" : "must select a valid database instance type." 56 | }, 57 | 58 | "DBAllocatedStorage" : { 59 | "Default": "5", 60 | "Description" : "The size of the database (Gb)", 61 | "Type": "Number", 62 | "MinValue": "5", 63 | "MaxValue": "1024", 64 | "ConstraintDescription" : "must be between 5 and 1024Gb." 65 | } 66 | }, 67 | 68 | "Resources" : { 69 | 70 | "MyDBSubnetGroup" : { 71 | "Type" : "AWS::RDS::DBSubnetGroup", 72 | "Properties" : { 73 | "DBSubnetGroupDescription" : "Subnets available for the RDS DB Instance", 74 | "SubnetIds" : { "Ref" : "Subnets" } 75 | } 76 | }, 77 | 78 | "MyDBSecurityGroup" : { 79 | "Type" : "AWS::RDS::DBSecurityGroup", 80 | "Properties" : { 81 | "GroupDescription" : "Security group for RDS DB Instance", 82 | "EC2VpcId" : { "Ref" : "VpcId" } 83 | } 84 | }, 85 | 86 | "MyDB" : { 87 | "Type" : "AWS::RDS::DBInstance", 88 | "Properties" : { 89 | "DBName" : { "Ref" : "DBName" }, 90 | "AllocatedStorage" : { "Ref" : "DBAllocatedStorage" }, 91 | "DBInstanceClass" : { "Ref" : "DBClass" }, 92 | "Engine" : "MySQL", 93 | "EngineVersion" : "5.5", 94 | "MasterUsername" : { "Ref" : "DBUsername" } , 95 | "MasterUserPassword" : { "Ref" : "DBPassword" }, 96 | "DBSubnetGroupName" : { "Ref" : "MyDBSubnetGroup" }, 97 | "DBSecurityGroups" : [ { "Ref" : "MyDBSecurityGroup" } ] 98 | } 99 | } 100 | }, 101 | 102 | "Outputs" : { 103 | "JDBCConnectionString": { 104 | "Description" : "JDBC connection string for database", 105 | "Value" : { "Fn::Join": [ "", [ "jdbc:mysql://", 106 | { "Fn::GetAtt": [ "MyDB", "Endpoint.Address" ] }, 107 | ":", 108 | { "Fn::GetAtt": [ "MyDB", "Endpoint.Port" ] }, 109 | "/", 110 | { "Ref": "DBName" }]]} 111 | } 112 | } 113 | } 114 | 115 | -------------------------------------------------------------------------------- /WaitObject.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | 4 | "Description" : "Example template showing how the WaitCondition and WaitConditionHandle are configured. With this template, the stack will not complete until either the WaitCondition timeout occurs, or you manually signal the WaitCondition object using the URL created by the WaitConditionHandle. You can use CURL or some other equivalent mechanism to signal the WaitCondition. To find the URL, use cfn-describe-stack-resources or the AWS Management Console to display the PhysicalResourceId of the WaitConditionHandle - this is the URL to use to signal. For details of the signal request see the AWS CloudFormation User Guide at http://docs.amazonwebservices.com/AWSCloudFormation/latest/UserGuide/", 5 | 6 | "Resources" : { 7 | "myWaitHandle" : { 8 | "Type" : "AWS::CloudFormation::WaitConditionHandle", 9 | "Properties" : { 10 | } 11 | }, 12 | "myWaitCondition" : { 13 | "Type" : "AWS::CloudFormation::WaitCondition", 14 | "Properties" : { 15 | "Handle" : { "Ref" : "myWaitHandle" }, 16 | "Timeout" : "300" 17 | } 18 | } 19 | }, 20 | "Outputs" : { 21 | "ApplicationData" : { 22 | "Value" : { "Fn::GetAtt" : [ "myWaitCondition", "Data" ]}, 23 | "Description" : "The data passed back as part of signalling the WaitCondition" 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /ec2_instance_with_instance_profile.template: -------------------------------------------------------------------------------- 1 | { 2 | "Description": "AWS CloudFormation Sample Template ec2_instance_with_instance_profile: Create an EC2 instance with an associated instance profile. **WARNING** This template creates one or more Amazon EC2 instances and an Amazon SQS queue. You will be billed for the AWS resources used if you create a stack from this template.", 3 | 4 | "AWSTemplateFormatVersion": "2010-09-09", 5 | 6 | "Mappings": { 7 | "RegionMap": { 8 | "us-east-1": { 9 | "AMI": "ami-7f418316" 10 | }, 11 | "us-west-1": { 12 | "AMI": "ami-951945d0" 13 | }, 14 | "us-west-2": { 15 | "AMI": "ami-16fd7026" 16 | }, 17 | "eu-west-1": { 18 | "AMI": "ami-24506250" 19 | }, 20 | "sa-east-1": { 21 | "AMI": "ami-3e3be423" 22 | }, 23 | "ap-southeast-1": { 24 | "AMI": "ami-74dda626" 25 | }, 26 | "ap-southeast-2": { 27 | "AMI": "ami-b3990e89" 28 | }, 29 | "ap-northeast-1": { 30 | "AMI": "ami-dcfa4edd" 31 | } 32 | } 33 | }, 34 | "Resources": { 35 | "myEC2Instance": { 36 | "Type": "AWS::EC2::Instance", 37 | "Properties": { 38 | "ImageId": { 39 | "Fn::FindInMap": [ 40 | "RegionMap", 41 | { 42 | "Ref": "AWS::Region" 43 | }, 44 | "AMI" 45 | ] 46 | }, 47 | "IamInstanceProfile": { 48 | "Ref": "RootInstanceProfile" 49 | } 50 | } 51 | }, 52 | "RootRole": { 53 | "Type": "AWS::IAM::Role", 54 | "Properties": { 55 | "AssumeRolePolicyDocument": { 56 | "Statement": [ 57 | { 58 | "Effect": "Allow", 59 | "Principal": { 60 | "Service": [ 61 | "ec2.amazonaws.com" 62 | ] 63 | }, 64 | "Action": [ 65 | "sts:AssumeRole" 66 | ] 67 | } 68 | ] 69 | }, 70 | "Path": "/" 71 | } 72 | }, 73 | "RolePolicies": { 74 | "Type": "AWS::IAM::Policy", 75 | "Properties": { 76 | "PolicyName": "root", 77 | "PolicyDocument": { 78 | "Statement": [ 79 | { 80 | "Effect": "Allow", 81 | "Action": "*", 82 | "Resource": "*" 83 | } 84 | ] 85 | }, 86 | "Roles": [ 87 | { 88 | "Ref": "RootRole" 89 | } 90 | ] 91 | } 92 | }, 93 | "RootInstanceProfile": { 94 | "Type": "AWS::IAM::InstanceProfile", 95 | "Properties": { 96 | "Path": "/", 97 | "Roles": [ 98 | { 99 | "Ref": "RootRole" 100 | } 101 | ] 102 | } 103 | } 104 | } 105 | } -------------------------------------------------------------------------------- /sns_httpendpoint.template: -------------------------------------------------------------------------------- 1 | { 2 | "AWSTemplateFormatVersion" : "2010-09-09", 3 | "Description" : "This sample template creates an HTTP endpoint using AWS Elastic Beanstalk, creates an Amazon SNS topic, and subscribes the HTTP endpoint to that topic. **WARNING** This template creates one or more Amazon EC2 instances. You will be billed for the AWS resources used if you create a stack from this template.", 4 | 5 | "Parameters" : { 6 | "KeyName" : { 7 | "Description" : "Name of an existing EC2 KeyPair to enable SSH access to the Amazon EC2 instance(s) in the environment deployed for the AWS Elastic Beanstalk application in this template.", 8 | "Type" : "String" 9 | }, 10 | "MyPublishUserPassword": { 11 | "NoEcho": "true", 12 | "Type": "String", 13 | "Description" : "Password for the IAM user MyPublishUser", 14 | "MinLength": "1", 15 | "MaxLength": "41", 16 | "AllowedPattern" : "[a-zA-Z0-9]*", 17 | "ConstraintDescription" : "must contain only alphanumeric characters." 18 | } 19 | }, 20 | 21 | "Resources" : { 22 | "MySNSTopic" : { 23 | "Type" : "AWS::SNS::Topic", 24 | "Properties" : { 25 | "Subscription" : [ { 26 | "Endpoint" : { 27 | "Fn::Join" : ["/", 28 | ["http:/", { "Fn::GetAtt" : ["MyEndpointEnvironment", "EndpointURL"] }, "myendpoint"]]}, 29 | "Protocol" : "http" 30 | } ] 31 | } 32 | }, 33 | "MyEndpointApplication" : { 34 | "Type" : "AWS::ElasticBeanstalk::Application", 35 | "Properties" : { 36 | "Description" : "HTTP endpoint to receive messages from Amazon SNS subscription.", 37 | "ApplicationVersions" : [{ 38 | "VersionLabel" : "Initial Version", 39 | "Description" : "Version 1.0", 40 | "SourceBundle" : { 41 | "S3Bucket" : "@@@CFN_EXAMPLES_DIR@@@", 42 | "S3Key" : "sns-http-example.war" 43 | } 44 | }], 45 | "ConfigurationTemplates" : [{ 46 | "TemplateName" : "DefaultConfiguration", 47 | "Description" : "Default Configuration Version 1.0 - with SSH access", 48 | "SolutionStackName" : "32bit Amazon Linux running Tomcat 7", 49 | "OptionSettings" : [{ 50 | "Namespace" : "aws:autoscaling:launchconfiguration", 51 | "OptionName" : "EC2KeyName", 52 | "Value" : { "Ref" : "KeyName" } 53 | }] 54 | }] 55 | } 56 | }, 57 | "MyEndpointEnvironment" : { 58 | "Type" : "AWS::ElasticBeanstalk::Environment", 59 | "Properties" : { 60 | "ApplicationName" : { "Ref" : "MyEndpointApplication" }, 61 | "Description" : "AWS Elastic Beanstalk Environment running HTTP endpoint for Amazon SNS subscription.", 62 | "TemplateName" : "DefaultConfiguration", 63 | "VersionLabel" : "Initial Version" 64 | } 65 | }, 66 | "MyPublishUser" : { 67 | "Type" : "AWS::IAM::User", 68 | "Properties" : { 69 | "LoginProfile": { 70 | "Password": {"Ref" : "MyPublishUserPassword"} 71 | } 72 | } 73 | }, 74 | "MyPublishUserKey" : { 75 | "Type" : "AWS::IAM::AccessKey", 76 | "Properties" : { 77 | "UserName" : {"Ref": "MyPublishUser"} 78 | } 79 | }, 80 | "MyPublishTopicGroup" : { 81 | "Type" : "AWS::IAM::Group", 82 | "Properties" : { 83 | "Policies": [ 84 | { 85 | "PolicyName": "MyTopicGroupPolicy", 86 | "PolicyDocument": {"Statement":[ 87 | { 88 | "Effect":"Allow", 89 | "Action":[ 90 | "sns:Publish" 91 | ], 92 | "Resource": {"Ref" : "MySNSTopic"} 93 | } 94 | ]} 95 | } 96 | ] 97 | } 98 | }, 99 | "AddUserToMyPublishTopicGroup" : { 100 | "Type" : "AWS::IAM::UserToGroupAddition", 101 | "Properties" : { 102 | "GroupName": {"Ref" : "MyPublishTopicGroup"}, 103 | "Users" : [{ "Ref" : "MyPublishUser" }] 104 | } 105 | } 106 | }, 107 | "Outputs" : { 108 | "MySNSTopicTopicARN" : { 109 | "Description" : "ARN for MySNSTopic.", 110 | "Value" : { "Ref" : "MySNSTopic" } 111 | }, 112 | "MyPublishUserInfo" : { 113 | "Description" : "Information about MyPublishUser.", 114 | "Value" : {"Fn::Join" : [ 115 | " ", 116 | [ 117 | "ARN:", 118 | { "Fn::GetAtt" : [ "MyPublishUser", "Arn" ] }, 119 | "Access Key:", 120 | {"Ref" : "MyPublishUserKey"}, 121 | "Secret Key:", 122 | {"Fn::GetAtt" : ["MyPublishUserKey", "SecretAccessKey"]} 123 | ] 124 | ]} 125 | }, 126 | "URL" : { 127 | "Description" : "URL of the HTTP endpoint hosted on AWS Elastic Beanstalk and subscribed to topic.", 128 | "Value" : { "Fn::Join" : ["/", ["http:/", { "Fn::GetAtt" : ["MyEndpointEnvironment", "EndpointURL"] }, "myendpoint"]]} 129 | } 130 | } 131 | } --------------------------------------------------------------------------------