Code Monkey home page Code Monkey logo

cloudformation-examples's Introduction

CloudFormation Examples

This repository contains CloudFormation example templates, each building on the previous stack:

  • Create Basic Amazon EC2 Instance
  • Enable SSH and HTTP/HTTPS Traffic
  • Assign an IP Address and Output the Website URL
  • Make the Template Dynamic
  • Add RDS Postgresql Database
  • Enable Inbound Traffic on Port 5432
  • Add CodeDeploy agent, tags, and CodeDeployTrustRole
  • Create CodePipeline
  • Delete Your Stacks & Snapshots

This repository accompanies the following blog posts:

1. Create Basic Amazon EC2 Instance

To create the stack using this template, run the create-stack command-line:

$ aws cloudformation create-stack --stack-name ec2-rds-example --template-body file://01_ec2.yaml

2. Enable SSH and HTTP/HTTPS Traffic

You can update your stack using the update-stack command:

$ aws cloudformation update-stack --stack-name ec2-rds-example --template-body file://02_ec2.yaml

3. Assign an IP Address and Output the Website URL

You can update your stack using the update-stack command:

$ aws cloudformation update-stack --stack-name ec2-rds-example --template-body file://03_ec2.yaml

4. Make the Template Dynamic

You can update the stack with this command, passing in the parameter values:

$ aws cloudformation update-stack --stack-name ec2-rds-example --template-body file://04_ec2.yaml \
--parameters ParameterKey=AvailabilityZone,ParameterValue=us-east-1a \
ParameterKey=EnvironmentType,ParameterValue=dev \
ParameterKey=KeyPairName,ParameterValue=jenna

5. Add RDS Postgresql Database

You can update the stack with this command, passing in the parameter values:

$ aws cloudformation update-stack --stack-name ec2-rds-example --template-body file://05_rds.yaml \
--parameters ParameterKey=AvailabilityZone,ParameterValue=us-east-1a \
ParameterKey=EnvironmentType,ParameterValue=dev \
ParameterKey=KeyPairName,ParameterValue=jenna \
ParameterKey=DBPassword,ParameterValue=Abcd1234

6. Enable Inbound Traffic on Port 5432

You can update the stack with this command, passing in the parameter values:

$ aws cloudformation update-stack --stack-name ec2-rds-example --template-body file://06_rds.yaml
--parameters ParameterKey=AvailabilityZone,ParameterValue=us-east-1a
ParameterKey=EnvironmentType,ParameterValue=dev
ParameterKey=KeyPairName,ParameterValue=jenna
ParameterKey=DBPassword,ParameterValue=Abcd1234

7. Delete Your Stacks & Snapshots

Don’t forget to delete your stack so you don’t accrue charges. You can do that with the delete-stack command:

$ aws cloudformation delete-stack --stack-name ec2-rds-example

If you left the DeletionPolicy and UpdateReplacePolicy properties set to snapshot and you no longer need those snapshots, then you can also delete those snapshots using the AWS Console so you don't accrue charges for those either.

Navigate to the RDS Management Console. From there, go to the Snapshots menu option. Select the snapshots created from your stack (hint: they will have a snapshot name that starts with your stack name) and select Delete snapshot from the Actions menu.

cloudformation-examples's People

Contributors

jennapederson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.