AWS
DevOps
  • knowledge
    • glossary
    • network knowledge
      • CIDR Block
      • OSI
      • List of Ports
      • Network model
    • AWS best practices
      • Least privilege principle
      • Support Plan
      • Well-architected framework
        • Well-architected framework
        • Cost optimization
        • Operational Excellence
        • Performance efficiency
        • Reliability
        • Security
    • Exams
      • DOP-C02
        • DOP-C02 topics
        • DOP-C02 Labs
      • DVA-C02
      • SOA-C02
  • services
    • access management
      • Directory Service
      • IAM
        • PassRole
      • IAM Identity Center (SSO)
      • Organizations
        • Organizational Unit
        • Control Tower
      • AD Domain Service
    • analytics
      • data analytic
        • Athena
        • QuickSight
        • Redshift
      • data collection
        • Data Lake
        • Lake Formation
      • data processing
        • EMR
        • Kinesis
        • Glue
          • Glue Data Catalog
      • OpenSearch
    • compute
      • Batch
      • EC2
        • Auto Scaling
        • AMI
        • ELB
          • Global accelerator
        • Security Group
        • EBS
        • EC2 Instance Store
        • Spot Fleet
      • Elastic Beanstalk
      • Lambda
        • Layer
        • Lambda API
      • Outposts
      • Wavelength
      • SAM
      • VMWare Cloud
    • container
      • Copilot
      • ECR
      • ECS
        • ECS Anywhere
      • EKS
        • EKS Anywhere
        • EKS Distro
      • Fargate
    • cost management
      • Budgets
      • Cost Explorer
      • Saving Plans
      • Compute Optimizer
    • database
      • Data Engineer
      • Document DB
      • DynamoDB
        • DynamoDB API
        • Scan
      • ElastiCache
      • Keyspaces
      • MemoryDB for Redis
      • Neptune
      • Quantum Ledger Database
      • RDS
        • Aurora
          • Aurora Global Database
          • Aurora Serverless
      • Timestream
    • devTools
      • CICD
        • CodeArtifact
        • CodeCommit
        • CodeBuild
        • CodeDeploy
        • CodePipeline
      • CloudFormation
      • CodeGuru
      • CodeStar
      • CodeWhisperer
      • X-Ray
      • Deployment strategies
    • finance
      • Cost explorer
    • integration
      • AppFlow
      • AppSync
      • EventBridge
      • MQ
      • SNS
      • SQS
      • Step Functions
      • SWF
    • management
      • AppConfig
      • AWS Backup
      • AWS CDK
      • Config
      • Grafana
      • Health Dashboard
      • Proton
      • Service Catalog
      • System Manager
      • SSM
      • Resource Group
      • OpsWorks (discontinued)
    • media
      • Elemental MediaConvert
      • Transcoder
    • messaging
      • SES
    • migration
      • Application Migration Service
      • DataSync
      • DMS
      • Migration Evaluator
      • Migration Hub
      • Server Migration Service
      • Snow Family
      • Transfer Family
    • ML
      • Comprehend
      • Forecast
      • Kendra
      • Lex
      • Rekognition
      • SageMaker
        • SageMaker Data Wrangler
        • SageMaker ML Lineage Tracking
    • monitoring
      • CloudTrail
      • CloudWatch
      • TrustedAdvisor
    • networking
      • CloudFront
      • Customer gateway
      • Edge Location
      • hybrid networking
        • Direct Connect
          • Direct Connect Gateway
        • Site-to-site VPN
      • PrivateLink
      • Region
        • AZ
      • Route 53
      • Transit Gateway
      • VPC
        • VPC Lattice
        • Subnet
          • NACL
        • Internet Gateway
        • Network Firewall
        • VPN
        • NAT Gateway
      • Virtual Private Gateway
    • security
      • Artifact
      • ACM
      • CloudHSM
      • Cognito
      • Detective
      • Firewall Manager
      • GuardDuty
      • Inspector
      • KMS
      • Macie
      • Network Firewall
      • Resource Access Manager
      • Security Hub
      • Secret Manager
      • Secret Hub
      • Shield
      • STS
      • Trusted Advisor
      • WAF
    • storage
      • Backup
      • EBS
      • EFS
      • FSx
      • S3
        • S3 Glacier
        • S3 Snippet
        • S3 Mountpoint
      • Snow family
      • Storage gateway
      • WorkDocs
    • web & mobile
      • Amplify
      • API Gateway
      • Device Farm
      • Pinpoint
Powered by GitBook
On this page
  • Overview
  • Benefits
  • Workflow
  • Features
  • vs.Elastic Beanstalk
  • CloudFormation Designer
  • Preview change
  • Dependency management
  • StackSets
  • Helper script
  • cfn-init
  • cfn-hup
  • cfn-signal
  • cfn-get-metadata
  • Best practices
  • Trivia
  • Concepts
  1. services
  2. devTools

CloudFormation

Infrastructure as Code service of AWS

Overview

Benefits

  • Scaling by sharing template for use across organization

  • Can share best practices and company policies.

  • Manage 3rd parties & private resources.

Workflow

  • Code the JSON/YAML template.

  • Review the code and Upload it to S3 bucket.

  • Using CloudFormation service (through CLI or Console) to create the Stack.

  • The CloudFormation will provision and configure resources base on the previous Stack.

Features

vs.Elastic Beanstalk

CloudFormation
Beanstalk

easily provision & run app

environment for managing application lifecycle

behind the scenes, it uses CloudFormation to control the workload

CloudFormation Designer

Help you design the CloudFormation template visually.

Preview change

Provide the change sets, show the summary of proposed changes.

Dependency management

  • You do NOT need to worry about the dependencies between the resources. It will determine the correct order of provision.

  • DependOn: specify explicitly the creation of specific resource follow another.

  • Dependent stacks also have implicit dependencies in the form of target properties !Ref, !GetAtt, and !Sub.

StackSets

Deploy CloudFormation stacks across multiple AWS accounts and regions with a single CloudFormation template.

By using create-stack-set CLI command, developer can deploy the same CloudFormation stack to multiple regions

Helper script

cfn-init

  • Implement as part of the user data.

  • execute CloudFormation metadata one time.

cfn-hup

monitor CloudFormation metadata, and applies change when discovered.

cfn-signal

provides a completion signal to designate the creation (successful or not) of a CreationPolicy or WaitCondition.

cfn-get-metadata

view cureent metadata stored within the AWS CloudFormation stack.

Best practices

  • Adopt DevOps and GitOps best practices

  • Automated deployments with pipeline integrations: GitHub Actions, AWS CodePipeline

  • Create a integartion pipeline.

  • DO NOT manually updating resouces that belong to a CloudFormation stack

Trivia

  • You need IAM policies if you want to upload an template.

    • to create a bucket S3

    • for CloudFront to access S3

  • If you create resource outside of CloudFormation, you can bring that resource into CloudFormation using resource import.

  • Some change require replacement. So sometime you will encounter error like can not remove resource when update resources.

Concepts

PreviousCodePipelineNextCodeGuru

Last updated 1 year ago

: happen when environment get change, while CloudFormation not aware of that.

Drift