SlideShare a Scribd company logo
CloudFormation
Experience
Kseniya Perapechyna
ITS Partner
Menu
● appetizer: Amazon Services
● main course: CloudFormation basis
● desert: Serverless Application Model (SAM)
CloudFormation experience
Imagine Flow
What is my main course?
CloudFormation Concept
Template Structure
AWSTemplateFormatVersion: "version date"
Description:
String
Metadata:
template metadata
Parameters:
set of parameters
Mappings:
set of mappings
Conditions:
set of conditions
Transform:
set of transforms
Resources:
set of resources
Outputs:
set of outputs
AWSTemplateFormatVersion: "2010-09-09"
Description: "CloudFormation template Example"
Metadata:
Databases: "Information about databases"
Instances: "Information about EC2 instances"
Parameters:
KinesisShardCount:
Type: Number
Default: 3
MinValue: 1
MaxValue: 10
Environment:
Type: String
Default: qa
AllowedValues:
- "prod"
- "qa"
- "dev"
Template Structure
AWSTemplateFormatVersion: "version date"
Description:
String
Metadata:
template metadata
Parameters:
set of parameters
Mappings:
set of mappings
Conditions:
set of conditions
Transform:
set of transforms
Resources:
set of resources
Outputs:
set of outputs
Mappings:
TemplateMapping:
prod:
lambdaName: "ProdLambda"
apiGatewayStageName: "prod01"
qa:
lambdaName: "QaLambda"
apiGatewayStageName: "qa02"
dev:
lambdaName: "DevLambda"
apiGatewayStageName: "dev"
FunctionName:
Fn::FindInMap: ["TemplateMapping", !Ref Environment, "lambdaName"]
Template Structure
AWSTemplateFormatVersion: "version date"
Description:
String
Metadata:
template metadata
Parameters:
set of parameters
Mappings:
set of mappings
Conditions:
set of conditions
Transform:
set of transforms
Resources:
set of resources
Outputs:
set of outputs
Conditions:
ProdEnvironment: !Equals [!Ref Environment, "prod"]
Resources:
KinesisStream:
Type: "AWS::Kinesis::Stream"
Condition: ProdEnvironment
DeletionPolicy: Delete
Properties:
...
Outputs:
kinesisId:
Value: !Ref KinesisStream
Export:
Name: !Sub "${Environment}-kinesis-id"
CloudFormation SNS Resource
Type: AWS::SNS::Topic
Properties:
DisplayName: String
KmsMasterKeyId: String
TopicName: String
Subscription:
- Subscription
EmailNotification:
Type: "AWS::SNS::Topic"
Properties:
TopicName: "interesting-information"
Subscription:
- "some.address@email.com"
- "one.more.address@email.com"
WorkerLambdaResource:
Type: "AWS::Lambda::Function"
Properties:
FunctionName: !FindInMap ["TemplateMapping", !Ref Environment, "lambdaName"]
Role: !Sub "arn:aws:iam::${AWS::AccountId}:role/lambda-role"
MemorySize: 512
Runtime: java8
Code:
S3Bucket: "lambda-functions"
S3Key: "worker.jar"
Handler: "com.example.ExampleHandler"
VpcConfig:
SecurityGroupIds: [sg-085912345678492fb]
SubnetIds:
- subnet-071f712345678e7c8
- subnet-07fd123456788a036
Environment:
Variables:
param: value
lambda_environment: !Ref Environment
Dessert please
Serverless Application Model
Transform: "AWS::Serverless-2016-10-31"
Serverless Resource types
● AWS::Serverless::Function
● AWS::Serverless::Api
● AWS::Serverless::Application
● AWS::Serverless::SimpleTable
● AWS::Serverless::LayerVersion
SAM Features
Globals Section
Globals:
Function:
Runtime: nodejs6.10
Timeout: 180
Handler: index.handler
Environment:
Variables:
TABLE_NAME: data-table
Api:
EndpointConfiguration: REGIONAL
Cors: "'www.example.com'"
SimpleTable:
SSESpecification:
SSEEnabled: true
API Gateway CloudFormation Resources
● API Gateway account
● REST API
● ...
● Resources hierarchy
● Methods
● Stages
● Deployments
● API key
● Custom domain name
● CORS (OPTIONS methods)
API Gateway Serverless Resources
Globals:
Api:
EndpointConfiguration: REGIONAL
Cors:
AllowHeaders: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'"
AllowMethods: "'POST,GET,OPTIONS'"
AllowOrigin: "'www.example.com'"
MethodSettings:
- HttpMethod: GET
ResourcePath: "/api/v1"
LoggingLevel: INFO
MetricsEnabled: false
CachingEnabled: false
ThrottlingRateLimit: 10000
ThrottlingBurstLimit: 5000
Resources:
ExampleRestApi:
Type: "AWS::Serverless::Api"
Properties:
Name: "REST API Example"
StageName: !Ref Environment
DefinitionUri:
Bucket: api-bucket
Key: swagger.yml
WorkerLambdaResorce:
Type: "AWS::Serverless::Function"
Properties:
FunctionName: worker-service
Role: !Sub "arn:aws:iam::${AWS::AccountId}:role/lambda-role"
Runtime: java8
MemorySize: 512
AutoPublishAlias: !Ref Environment
CodeUri:
S3Bucket: "lambda-functions"
S3Key: "worker.jar"
Handler: "com.example.ExampleHandler"
Environment:
Variables:
lambda_environment: !Ref Environment
Events:
GetResource:
Type: Api
Properties:
Path: "/api/v1/worker"
Method: GET
SAM Drawbacks
- API Key creation does not support
- AWS::Serverless::API creates additional stage
- Lambda permission issue
Events:
PostResource:
Type: Api
Properties:
RestApiId: !Ref ExampleRestApi
Path: "/api/v1/worker"
Method: GET
LambdaInvokePermission:
Type: "AWS::Lambda::Permission"
Properties:
FunctionName: !Ref WorkerLambdaResorce
Action: "lambda:InvokeFunction"
...
Practical Use
1. One text file described your resources
2. Integration with AWS Code Pipeline
3. Work with AWS Service Catalog
Questions

More Related Content

PPTX
AWS CloudFormation Session
PPTX
Infrastructure as Code - AWS CloudFormation
PPTX
How to Write IAC for Serverless
PDF
2013 05-openstack-israel-heat
PPTX
Infrastructure as Code in AWS using Cloudformation
PDF
2013 05-fite-club-working-models-cloud-growing-up
PPTX
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
PPTX
Cloudformation101
AWS CloudFormation Session
Infrastructure as Code - AWS CloudFormation
How to Write IAC for Serverless
2013 05-openstack-israel-heat
Infrastructure as Code in AWS using Cloudformation
2013 05-fite-club-working-models-cloud-growing-up
AWS Presents: Infrastructure as Code on AWS - ChefConf 2015
Cloudformation101

What's hot (8)

PDF
AWS Step Functions를 이용한 마이크로서비스 개발하기 - 김현민 (4CSoft)
PPTX
Advanced Discussion on Cloud Formation
PPTX
AWS Cloud Formation
PDF
Development in the could: How do we do it(Cloud computing. Microservices. Faas)
DOCX
Template of nested stack
PPTX
Introduction to aws cloud formation
PPTX
Spring cloud config
PDF
Going Serverless
AWS Step Functions를 이용한 마이크로서비스 개발하기 - 김현민 (4CSoft)
Advanced Discussion on Cloud Formation
AWS Cloud Formation
Development in the could: How do we do it(Cloud computing. Microservices. Faas)
Template of nested stack
Introduction to aws cloud formation
Spring cloud config
Going Serverless
Ad

Similar to CloudFormation experience (20)

PDF
Thinking Serverless (SVS213 AWS re:Invent 2019)
PDF
AWS ❤ SAM - Serverless on stage #9 (Milan, 20/02/2018)
PDF
Voxxed Athens 2018 - Serverless by Design
PPTX
Serverless Applications with AWS SAM
PPTX
Serverless Developer Experience I AWS Dev Day 2018
PDF
Building Serverless Microservices with AWS
PDF
Serverless Development To Production Pipeline
PDF
Serverless architecture-patterns-and-best-practices
PDF
Serverless Architectural Patterns and Best Practices | AWS
PDF
AWS DevDay AWS SAM을 이용한 백오피스 마이그레이션
PDF
AWS SAM(Serverless Application Model) 을 이용한 백오피스 마이그레이션 (현창훈, HBSmith) :: AWS...
PDF
AWSug.nl Meetup @ New10 - SAM
PDF
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
PPTX
Primeros pasos en desarrollo serverless
PDF
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
PDF
Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
PDF
S3 to Lambda:: A flexible pattern at the heart of serverless applications (SV...
PDF
Serverless Day Zero: How to Serveless [July 2019]
PPTX
Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...
PPTX
AWS Serverless concepts and solutions
Thinking Serverless (SVS213 AWS re:Invent 2019)
AWS ❤ SAM - Serverless on stage #9 (Milan, 20/02/2018)
Voxxed Athens 2018 - Serverless by Design
Serverless Applications with AWS SAM
Serverless Developer Experience I AWS Dev Day 2018
Building Serverless Microservices with AWS
Serverless Development To Production Pipeline
Serverless architecture-patterns-and-best-practices
Serverless Architectural Patterns and Best Practices | AWS
AWS DevDay AWS SAM을 이용한 백오피스 마이그레이션
AWS SAM(Serverless Application Model) 을 이용한 백오피스 마이그레이션 (현창훈, HBSmith) :: AWS...
AWSug.nl Meetup @ New10 - SAM
Skillenza Build with Serverless Challenge - Advanced Serverless Concepts
Primeros pasos en desarrollo serverless
Modern Applications Web Day | Impress Your Friends with Your First Serverless...
Let Your Business Logic go Serverless | AWS Summit Tel Aviv 2019
S3 to Lambda:: A flexible pattern at the heart of serverless applications (SV...
Serverless Day Zero: How to Serveless [July 2019]
Serverless Streams, Topics, Queues, & APIs! Pick the Right Serverless Applica...
AWS Serverless concepts and solutions
Ad

More from Vitebsk Miniq (20)

PDF
Runtime compilation and code execution in groovy
PDF
The 5 Laws of Software Estimates
PDF
Latest & Greatest Observability Release 7.9
PDF
Тестирование Spring-based приложений
PDF
Семантический поиск - что это, как работает и чем отличается от просто поиска
PDF
Локализационное тестирование - это не только перевод
PDF
ISTQB Сертификация тестировщиков: быть или не быть?
PDF
Apollo GraphQL Federation
PDF
Who is a functional tester
PDF
Crawling healthy
PDF
Вперед в прошлое
PDF
Learning Intelligence: the story of mine
PDF
Как программисты могут спасти мир
PDF
Использование AzureDevOps при разработке микросервисных приложений
PDF
Distributed tracing system in action. Instana Tracing.
PDF
Насорил - убери!
PDF
Styled-components. Что? Когда? И зачем?
PDF
Красные флаги и розовые очки
PDF
CSS. Практика
PDF
Разделяй и властвуй!
Runtime compilation and code execution in groovy
The 5 Laws of Software Estimates
Latest & Greatest Observability Release 7.9
Тестирование Spring-based приложений
Семантический поиск - что это, как работает и чем отличается от просто поиска
Локализационное тестирование - это не только перевод
ISTQB Сертификация тестировщиков: быть или не быть?
Apollo GraphQL Federation
Who is a functional tester
Crawling healthy
Вперед в прошлое
Learning Intelligence: the story of mine
Как программисты могут спасти мир
Использование AzureDevOps при разработке микросервисных приложений
Distributed tracing system in action. Instana Tracing.
Насорил - убери!
Styled-components. Что? Когда? И зачем?
Красные флаги и розовые очки
CSS. Практика
Разделяй и властвуй!

Recently uploaded (20)

PDF
17 Powerful Integrations Your Next-Gen MLM Software Needs
PDF
Autodesk AutoCAD Crack Free Download 2025
PDF
Cost to Outsource Software Development in 2025
PPTX
Monitoring Stack: Grafana, Loki & Promtail
PPTX
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
PPTX
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
PDF
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
PPTX
history of c programming in notes for students .pptx
PDF
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
PDF
AutoCAD Professional Crack 2025 With License Key
PDF
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
PPTX
Patient Appointment Booking in Odoo with online payment
PDF
iTop VPN Crack Latest Version Full Key 2025
PPTX
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
PDF
Design an Analysis of Algorithms II-SECS-1021-03
PDF
Digital Systems & Binary Numbers (comprehensive )
PPTX
Computer Software and OS of computer science of grade 11.pptx
PDF
Design an Analysis of Algorithms I-SECS-1021-03
PPTX
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
PDF
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...
17 Powerful Integrations Your Next-Gen MLM Software Needs
Autodesk AutoCAD Crack Free Download 2025
Cost to Outsource Software Development in 2025
Monitoring Stack: Grafana, Loki & Promtail
Embracing Complexity in Serverless! GOTO Serverless Bengaluru
Log360_SIEM_Solutions Overview PPT_Feb 2020.pptx
Adobe Premiere Pro 2025 (v24.5.0.057) Crack free
history of c programming in notes for students .pptx
Product Update: Alluxio AI 3.7 Now with Sub-Millisecond Latency
AutoCAD Professional Crack 2025 With License Key
Tally Prime Crack Download New Version 5.1 [2025] (License Key Free
Patient Appointment Booking in Odoo with online payment
iTop VPN Crack Latest Version Full Key 2025
WiFi Honeypot Detecscfddssdffsedfseztor.pptx
Design an Analysis of Algorithms II-SECS-1021-03
Digital Systems & Binary Numbers (comprehensive )
Computer Software and OS of computer science of grade 11.pptx
Design an Analysis of Algorithms I-SECS-1021-03
Agentic AI Use Case- Contract Lifecycle Management (CLM).pptx
AI-Powered Threat Modeling: The Future of Cybersecurity by Arun Kumar Elengov...

CloudFormation experience

  • 2. Menu ● appetizer: Amazon Services ● main course: CloudFormation basis ● desert: Serverless Application Model (SAM)
  • 5. What is my main course?
  • 7. Template Structure AWSTemplateFormatVersion: "version date" Description: String Metadata: template metadata Parameters: set of parameters Mappings: set of mappings Conditions: set of conditions Transform: set of transforms Resources: set of resources Outputs: set of outputs AWSTemplateFormatVersion: "2010-09-09" Description: "CloudFormation template Example" Metadata: Databases: "Information about databases" Instances: "Information about EC2 instances" Parameters: KinesisShardCount: Type: Number Default: 3 MinValue: 1 MaxValue: 10 Environment: Type: String Default: qa AllowedValues: - "prod" - "qa" - "dev"
  • 8. Template Structure AWSTemplateFormatVersion: "version date" Description: String Metadata: template metadata Parameters: set of parameters Mappings: set of mappings Conditions: set of conditions Transform: set of transforms Resources: set of resources Outputs: set of outputs Mappings: TemplateMapping: prod: lambdaName: "ProdLambda" apiGatewayStageName: "prod01" qa: lambdaName: "QaLambda" apiGatewayStageName: "qa02" dev: lambdaName: "DevLambda" apiGatewayStageName: "dev" FunctionName: Fn::FindInMap: ["TemplateMapping", !Ref Environment, "lambdaName"]
  • 9. Template Structure AWSTemplateFormatVersion: "version date" Description: String Metadata: template metadata Parameters: set of parameters Mappings: set of mappings Conditions: set of conditions Transform: set of transforms Resources: set of resources Outputs: set of outputs Conditions: ProdEnvironment: !Equals [!Ref Environment, "prod"] Resources: KinesisStream: Type: "AWS::Kinesis::Stream" Condition: ProdEnvironment DeletionPolicy: Delete Properties: ... Outputs: kinesisId: Value: !Ref KinesisStream Export: Name: !Sub "${Environment}-kinesis-id"
  • 10. CloudFormation SNS Resource Type: AWS::SNS::Topic Properties: DisplayName: String KmsMasterKeyId: String TopicName: String Subscription: - Subscription EmailNotification: Type: "AWS::SNS::Topic" Properties: TopicName: "interesting-information" Subscription: - "some.address@email.com" - "one.more.address@email.com"
  • 11. WorkerLambdaResource: Type: "AWS::Lambda::Function" Properties: FunctionName: !FindInMap ["TemplateMapping", !Ref Environment, "lambdaName"] Role: !Sub "arn:aws:iam::${AWS::AccountId}:role/lambda-role" MemorySize: 512 Runtime: java8 Code: S3Bucket: "lambda-functions" S3Key: "worker.jar" Handler: "com.example.ExampleHandler" VpcConfig: SecurityGroupIds: [sg-085912345678492fb] SubnetIds: - subnet-071f712345678e7c8 - subnet-07fd123456788a036 Environment: Variables: param: value lambda_environment: !Ref Environment
  • 13. Serverless Application Model Transform: "AWS::Serverless-2016-10-31"
  • 14. Serverless Resource types ● AWS::Serverless::Function ● AWS::Serverless::Api ● AWS::Serverless::Application ● AWS::Serverless::SimpleTable ● AWS::Serverless::LayerVersion
  • 15. SAM Features Globals Section Globals: Function: Runtime: nodejs6.10 Timeout: 180 Handler: index.handler Environment: Variables: TABLE_NAME: data-table Api: EndpointConfiguration: REGIONAL Cors: "'www.example.com'" SimpleTable: SSESpecification: SSEEnabled: true
  • 16. API Gateway CloudFormation Resources ● API Gateway account ● REST API ● ... ● Resources hierarchy ● Methods ● Stages ● Deployments ● API key ● Custom domain name ● CORS (OPTIONS methods)
  • 17. API Gateway Serverless Resources Globals: Api: EndpointConfiguration: REGIONAL Cors: AllowHeaders: "'Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token'" AllowMethods: "'POST,GET,OPTIONS'" AllowOrigin: "'www.example.com'" MethodSettings: - HttpMethod: GET ResourcePath: "/api/v1" LoggingLevel: INFO MetricsEnabled: false CachingEnabled: false ThrottlingRateLimit: 10000 ThrottlingBurstLimit: 5000 Resources: ExampleRestApi: Type: "AWS::Serverless::Api" Properties: Name: "REST API Example" StageName: !Ref Environment DefinitionUri: Bucket: api-bucket Key: swagger.yml
  • 18. WorkerLambdaResorce: Type: "AWS::Serverless::Function" Properties: FunctionName: worker-service Role: !Sub "arn:aws:iam::${AWS::AccountId}:role/lambda-role" Runtime: java8 MemorySize: 512 AutoPublishAlias: !Ref Environment CodeUri: S3Bucket: "lambda-functions" S3Key: "worker.jar" Handler: "com.example.ExampleHandler" Environment: Variables: lambda_environment: !Ref Environment Events: GetResource: Type: Api Properties: Path: "/api/v1/worker" Method: GET
  • 19. SAM Drawbacks - API Key creation does not support - AWS::Serverless::API creates additional stage - Lambda permission issue Events: PostResource: Type: Api Properties: RestApiId: !Ref ExampleRestApi Path: "/api/v1/worker" Method: GET LambdaInvokePermission: Type: "AWS::Lambda::Permission" Properties: FunctionName: !Ref WorkerLambdaResorce Action: "lambda:InvokeFunction" ...
  • 20. Practical Use 1. One text file described your resources 2. Integration with AWS Code Pipeline 3. Work with AWS Service Catalog