This repository contains a collaboration of general and specific Amazon Web Services CloudFormation Template Examples.
The basic design is a layered approach so there is less repeat content between all the templates.
That way you can build a custom environment by picking the solution templates you wish to use.
In other words you won't see a VPC created over and over throughout the templates.
You simply use the VPC template then move to the next piece you would like to create.
Also, The general design leans towards not having to refactor the template to fit your account/environment.
By using the configured parameters from the console or CLI you should be able to use the template without the need to edit it.
The templates generally output all the information you may need for another template.
So, be sure to examine the Outputs tab after creating the stack.
The AWS CLI examples can be dropped in a shell script and/or added to your CI/CD solution to spin up solutions in a fully automated fashion.
Of course logic around updating stacks, deleting and checking for success/failure should be addressed.
With a simple shell script and a customized parameter json file you can spin up stacks quickly and consistently.
Furthermore it's just as easy to tear a CloudFormation stack versus if all the objects where created manually.
One template to rule them all... These are master templates that call nested templates.
These are good to build out a full environment without having to run each template individually.
Coupled with a custom parameters JSON file can give you a one command solution to a complex setup and eliminate the need to duplicate code.
For instance you could have a VPC, NAT, RDS and Autoscaling Webapp behind an ELB and Update DNS all in one
command using various foundational templates that I've creates to be used together.
Creates a NAT Gateway on an existing VPC with Public (IGW) and Private subnets. Private route table is updated to route traffic to the NAT gateway a Public subnet that has an Internet Gateway Attached.
Prerequisites
VPC
Public Subnet, IGW, Private Subnet/s.
Either use an existing VPC Infrastructure or you can use the following VPC Template to create a one.
Creates a Site-to-Site BGP VPN Connection in and existing VPC with public and/or private networks.
There is an option to not exclude allowing VPN access to the public networks.
Simply select false for the 'Include Public Subnets', leave default value in Public Network ACL and Route Table.
The values will just be ignored. This only sets up the AWS side of the VPN.
After the CloudFormation creates the objects you'll then need to configure your remote VPN Device.
Here's an article that gives the configuration steps for configuring a Sophos UTM v9 VPN endpoint.
This assumes that the Private Network ACL allows all outbound. Lastly, the Private Network ACL inbound is updated to allow the remote network block specified.
Prerequisites
VPC
Public Subnet, IGW, Private Subnet/s.
Either use an existing VPC Infrastructure or you can use the following VPC Template to create a one.
Remote Network (Office) VPN Device WAN IP
Remote Network CIDR Block to Allow Access and Propagate.
Create an Autoscaling group in 3 private subnets from a baked AMI, an Elastic Load Balancer in 3 public subnets and S3 ELB Logging Bucket.
Option to use SSL/TLS on ELB. Option to update Route 53 Hosted DNS alias to point to the ELB.
Setup to add RDS Access Security Group. Does not create an RDS Instance. Use an RDS Instance Cloudformation Template first.
Creates a Chef Complianc Web server in a Public Subnet with Internet Gatewayy attached on an existing VPC.
It then attaches an EIP and finally adds the instance to an existing instance-to-instance security group.
Prerequisites
VPC
Public Subnet, IGW, Private Subnet/s.
Either use an existing VPC Infrastructure or you can use the following VPC Template to create a one.
Creates three test instances in an existing VPC. Each instance is a different operating system. They are; Red Hat Enterprise Linux 7, Ubuntu 14 and Windows 2012 R2.
Launching autoscaling/bakedami-elb-rdsbackend.yml by clicking "launch" expects the template to be in S3, but CF complains with this message; Template validation error: S3 error: The specified key does not exist.
I stumbled upon this piece of code https://github.com/stelligent/cloudformation_templates/blob/master/labs/codebuild/codebuild.yml#L194 while searching for reference how to create a proper CodeBuild service role. Giving a role arn:aws:iam::aws:policy/AdministratorAccess is a terrible security practice, even for example code. A malicious pull request could alter the buildspec.yml and access the whole AWS account.
I've run into a problem when it comes to CodePipeline notifications, and it seems that your code (codepipeline-notifications.yml) is experiencing the same problem. If you can, please verify that your template isn't working as expected.
Steps to reproduce:
Run aws cloudformation create-stack --stack-name Notifications --template-body file://codepipeline-notifications.yml --parameter ParameterKey=EmailAddress,ParameterValue=<your email> and wait for stack to be created
Accept the subscription confirmation by clicking the link in the received e-mail
Trigger a CodePipeline that is configured to fail and wait for it to complete
Verify that you haven't received an e-mail, but at this point you ought to have
Navigate to CloudWatch and edit your rule. Don't change anything, just click through the wizard and update the rule in the console.
Trigger the pipeline again. This time you will receive an e-mail.
As I said, I don't think anything is wrong in your template. I'm experiencing the same issue with one of my templates. But it would be beneficial if your sample indicated that the template didn't behave as expected, given you are able to reproduce the issue.