AWS CloudFormation Resource Types: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(11 intermediate revisions by the same user not shown)
Line 49: Line 49:
     Properties:
     Properties:
       Name: !Ref AWS::StackName
       Name: !Ref AWS::StackName
=AWS::DynamoDB=
{{Internal|Amazon DynamoDB Operations#CloudFormation_Support|Amazon DynamoDB Operations}}


=AWS::EC2=
=AWS::EC2=
==AWS::EC2::SecurityGroup==
==AWS::EC2::SecurityGroup==
{{Internal|AWS_Security_Operations#Create_a_Security_Group_with_CloudFormation|Create a Security Group with CloudFormation}}
==AWS::EC2::VPC==
{{Internal|Amazon_VPC_Operations#Create_a_VPC_with_CloudFormation|Amazon VPC Operations}}


Resources:
==AWS::EC2::Instance==
  ServiceSecurityGroup:
 
    Type: AWS::EC2::SecurityGroup
{{Internal|Amazon_EC2_Operations#Create_an_EC2_Instance_with_CloudFormation|Create an EC2 Instance with CloudFormation}}
    Properties:
      GroupDescription: '...'
      VpcId:
        Fn::ImportValue: !Join [':', [!Ref 'DeploymentStackName', 'VPCId']]
      GroupName: !Sub ${ECRRepository}-sg
      SecurityGroupIngress:
        - IpProtocol: -1
          CidrIp: 10.0.0.0/8


=AWS::ECR=
=AWS::ECR=
Line 97: Line 97:
     Properties:
     Properties:
       RoleName: !Sub '${AWS::StackName}-codebuild-service-role'
       RoleName: !Sub '${AWS::StackName}-codebuild-service-role'
      Description: A description of the role.
       Path: '/service-role/'
       Path: '/service-role/'
       AssumeRolePolicyDocument:
       AssumeRolePolicyDocument:
Line 119: Line 120:


'''Naming'''. If this role is declared by a "thalarion" stack, then, after successful creation, the role's physical ID will be "thalarion-CodeBuildServiceRole-A479B6WNRHSSG". A custom name can be forced with the "RoleName", as shown above.
'''Naming'''. If this role is declared by a "thalarion" stack, then, after successful creation, the role's physical ID will be "thalarion-CodeBuildServiceRole-A479B6WNRHSSG". A custom name can be forced with the "RoleName", as shown above.
=AWS::Kinesis=
{{Internal|Amazon Kinesis Operations#CloudFormation_Support|Amazon Kinesis Operations}}
=AWS::KMS=
{{Internal|Amazon KMS Operations#CloudFormation|Amazon KMS Operations}}


=AWS::Lambda=
=AWS::Lambda=
==AWS::Lambda::Function==
 
{{Internal|AWS Lambda Create a Lambda Function with CloudFromation|AWS Lambda Create a Lambda Function with CloudFromation}}


=AWS::Logs=
=AWS::Logs=
Line 128: Line 136:
{{Internal|Amazon CloudWatch Operations|CloudWatch Operations}}
{{Internal|Amazon CloudWatch Operations|CloudWatch Operations}}


=AWS::S3=
=<span id='AWS::S3::Bucket'></span>AWS::S3=
 
==AWS::S3::Bucket==
 
{{External|[https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-s3-bucket.html AWS::S3::Bucket]}}
 
Resources:
  TestBucket:
    Type: AWS::S3::Bucket
    Properties:
      BucketName: !Sub '${AWS::StackName}-test-bucket'
      AccessControl: BucketOwnerFullControl


'''Naming''' If no "BucketName" property is specified, the bucket will be named based on the pattern <''stack-name''>-<''resource-name-all-lowercases''>-2a3et4c9f3bas. A custom name can be set with "BucketName".
{{Internal|Amazon_S3_Operations#Create_an_S3_Bucket_With_CloudFormation|S3 Operations}}


=AWS::Serverless=
=AWS::Serverless=

Latest revision as of 21:10, 27 April 2019

External

Internal

AWS::ApiGateway

Amazon API Gateway Deployment with CloudFormation

AWS::CloudFormation

AWS::CloudFormation::Stack

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-stack.html

AWS::CloudFormation::Stack enables nesting another stack as a resource within a template.

AWS::CodeBuild

AWS::CodeBuild::Project

Note that if the "Name" property is used, the physical ID of the created CodeBuild project will use that value, otherwise the name will be generated with the pattern CodeBuildProjectLogicalID-apCFy5I1KyH8. Recommended name:

Resources:
  CodeBuildProject:
    Type: AWS::CodeBuild::Project
    Properties:
      Name: !Ref AWS::StackName

For an example of a CodeBuild build project that integrates with a CodePipeline see:

CodePipeline-Driven CodeBuild Builds

AWS::CodePipeline

AWS::CodePipeline::Pipeline

Pipeline Structure

Creates a CodePipeline pipeline. Other pipeline examples:

Pipeline that Delegates the Build to the CodeBuild Build Project

Note that if the "Name" property is used, the physical ID of the created pipeline will use that value, otherwise the name will be generated with the pattern stack-name-Pipeline-24RCYXM52UE6A. Recommended name:

Resources:
  Pipeline:
    Type: AWS::CodePipeline::Pipeline
    Properties:
      Name: !Ref AWS::StackName

AWS::DynamoDB

Amazon DynamoDB Operations

AWS::EC2

AWS::EC2::SecurityGroup

Create a Security Group with CloudFormation

AWS::EC2::VPC

Amazon VPC Operations

AWS::EC2::Instance

Create an EC2 Instance with CloudFormation

AWS::ECR

AWS::ECR::Repository

AWS::ECR::Repository
Resources:
  Repository:
    Type: AWS::ECR::Repository
    Properties:
      RepositoryName: some-docker-repository-name

AWS::ECS

Amazon ECS Deployment with CloudFormation

AWS::ElasticLoadBalancingV2

AWS Elastic Load Balancing V2 Deployment with CloudFormation

AWS::IAM

AWS::IAM::Role

Role

The following sequence creates an IAM Role:

Resources:
  CodeBuildServiceRole:
    Type: AWS::IAM::Role
    Properties:
      RoleName: !Sub '${AWS::StackName}-codebuild-service-role'
      Description: A description of the role.
      Path: '/service-role/'
      AssumeRolePolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: 'Allow'
            Principal:
              Service:
                - "codebuild.amazonaws.com"
            Action:
              - "sts:AssumeRole"
      Policies:
        - PolicyName: 'aggregated-inline-policy'
          PolicyDocument:
            Version: '2012-10-17'
            Statement:
              - Effect: 'Allow'
                Action:
                  - 's3:ListBucket'
                Resource:
                  - '*'

Naming. If this role is declared by a "thalarion" stack, then, after successful creation, the role's physical ID will be "thalarion-CodeBuildServiceRole-A479B6WNRHSSG". A custom name can be forced with the "RoleName", as shown above.

AWS::Kinesis

Amazon Kinesis Operations

AWS::KMS

Amazon KMS Operations

AWS::Lambda

AWS Lambda Create a Lambda Function with CloudFromation

AWS::Logs

AWS::Logs::LogGroup

CloudWatch Operations

AWS::S3

S3 Operations

AWS::Serverless

AWS::ServiceDiscovery

AWS::ServiceDiscovery::Service