Giter VIP home page Giter VIP logo

cf-conditions's Introduction

cf-conditions

This repository stores CloudFormation templates created as examples for the article Use Conditions to create reusable CloudFormation templates posted on www.thenindiecoder.cloud.

Prerequisites

You need to have the AWS CLI installed and properly configured.

Conditions at the resource level

Template file: cf-conditions-resource-level.yml.

To create a cloudFormation stack from this template, one for each environment, run the following commands:

create stack in the test environment

aws cloudformation create-stack --stack-name cf-conditions-resource-test --template-body file://cf-conditions-resource-level.yml --parameters ParameterKey=Environment,ParameterValue=test

create stack in the prod environment

aws cloudformation create-stack --stack-name cf-conditions-resource-prod --template-body file://cf-conditions-resource-level.yml --parameters ParameterKey=Environment,ParameterValue=prod

Conditions at the property level

Template file: cf-conditions-property-level.yml.

To create a cloudFormation stack from this template, one for each environment, run the following commands:

create stack in the test environment

aws cloudformation create-stack --stack-name cf-conditions-property-test --template-body file://cf-conditions-property-level.yml --parameters ParameterKey=Environment,ParameterValue=test

create stack in the prod environment

aws cloudformation create-stack --stack-name cf-conditions-property-prod --template-body file://cf-conditions-property-level.yml --parameters ParameterKey=Environment,ParameterValue=prod

Conditions on property level - Including or Excluding a Property

Template file: cf-conditions-property-level-noValue.yml.

To create a cloudFormation stack from this template, one for each environment, run the following commands:

create stack in the test environment

aws cloudformation create-stack --stack-name cf-conditions-property-noValue-test --template-body file://cf-conditions-property-level-noValue.yml --parameters ParameterKey=Environment,ParameterValue=test

create stack in the prod environment

aws cloudformation create-stack --stack-name cf-conditions-property-noValue-prod --template-body file://cf-conditions-property-level-noValue.yml --parameters ParameterKey=Environment,ParameterValue=prod

Working with Nested Conditions

Template file: cf-conditions-nested-conditions.yml.

To create a cloudFormation stack from this template, one for each environment, run the following commands:

create stack in the dev environment

aws cloudformation create-stack --stack-name cf-conditions-nested-conditions-dev --template-body file://cf-conditions-nested-conditions.yml --parameters ParameterKey=Environment,ParameterValue=dev

create stack in the test environment

aws cloudformation create-stack --stack-name cf-conditions-nested-conditions-test --template-body file://cf-conditions-nested-conditions.yml --parameters ParameterKey=Environment,ParameterValue=test

create stack in the prod environment

aws cloudformation create-stack --stack-name cf-conditions-nested-conditions-prod --template-body file://cf-conditions-nested-conditions.yml --parameters ParameterKey=Environment,ParameterValue=prod

Clean up

๐Ÿšจ Stacks CLEAN UP: Remember to delete all your stacks to avoid unwanted costs ๐Ÿšจ

Run the following command for each of the stacks you created. Replace myteststack with the actual name of the stack you want to delete.

aws cloudformation delete-stack --stack-name myteststack

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.