Skip to content

Instantly share code, notes, and snippets.

@wilmoore
Last active August 13, 2024 05:13
Show Gist options
  • Select an option

  • Save wilmoore/fc61e31ae67d4d7f477bd80011be9649 to your computer and use it in GitHub Desktop.

Select an option

Save wilmoore/fc61e31ae67d4d7f477bd80011be9649 to your computer and use it in GitHub Desktop.
Software Engineering :: Cloud :: AWS :: AWS CloudFormation

Software Engineering :: Cloud :: AWS :: AWS CloudFormation

Made with ♥ by Polyglot.

related
research

Certification

Getting Started

Testing

Includes

AWS::Include Transform
Examples
Transform:
  Name: 'AWS::Include'
  Parameters:
    Location: 's3://MyAmazonS3BucketName/MyFileName.yaml'

Lint

Template Anatomy

Best Practices

Examples

Description Block
Description: > 
 Provide meaningful 
 description about 
 the template. 
CopyAdd HighlightAdd Note
nested-stack-example.cft.yaml
---
AWSTemplateFormatVersion: '2010-09-09'
Description: https://aws.amazon.com/blogs/devops/use-nested-stacks-to-create-reusable-templates-and-support-role-specialization/
Resources:
  Vpc:
    Type: 'AWS::CloudFormation::Stack'
    Properties:
      Parameters:
        S3Endpoint: 'false' # speed up the example
        DynamoDBEndpoint: 'false' # speed up the example
        FlowLog: 'false' # speed up the example
        NatGateways: 'false' # speed up the example
      TemplateURL: './node_modules/@cfn-modules/vpc/module.yml'
  Instance:
    Type: 'AWS::CloudFormation::Stack'
    Properties:
      Parameters:
        VpcModule: !GetAtt 'Vpc.Outputs.StackName' # reference the vpc module
        UserData: |
          yum install -y httpd24
          service httpd start
          echo "cfn-modules" > /var/www/html/index.html
        IngressTcpPort1: '80' # open up port 80 to the world
      TemplateURL: './node_modules/@cfn-modules/ec2-instance-amazon-linux/module.yml'
Outputs:
  Url:
    Value: !Sub 'http://${Instance.Outputs.PublicIpAddress}'
example.cft.yaml
---
AWSTemplateFormatVersion: '2010-09-09'
Metadata: 
  License: Apache-2.0
Description: ...
Parameters:
Mappings:
Conditions:
Transform:
Resources:
Outputs:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment