SlideShare a Scribd company logo
1 of 24
Download to read offline
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de
AWS CloudFormation Macros
Custom processing on CloudFormation templates
code examples: https://github.com/mnwk/cloudformation-macro-example
contact: xing.to/mnwk
mail@maiknowak.de
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 2
Maik Nowak - IT-Freelancer
Serverless IoT platform
Tech stack:
TypeScript
CloudFormation
Gitlab-CI
AWS:
...
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de
CloudFormation and Macros
3
describe and provision infrastructure resourcesCFN template:
IaC and automation
JSON or YAML
CFN macro: preprocessor for CFN templates
transformation of template fragments
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de
macros?
4
# aws cloudformation deploy
?
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de
macros?
5
fragment
local, CI, ... CloudFormation macro
# aws cloudformation deploy
template process each macro
processed fragment transform fragment
validation validation of the template
macros are processed before changeset
creation
CFN console: “processed template”
create
changeset
update
stack
preprocessing
execution
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 6
Resources:
MyBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: MyBucket
'Fn::Transform':
Name: 'MyMacro'
local macros - Fn::Transform global macros - Transform section
Transform: 'MyMacro'
Resources:
MyBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: MyBucket
use macros | scope | parameter
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 7
Resources:
MyBucket:
Type: AWS::S3::Bucket
MyApi:
'Fn::Transform':
Name: 'MyMacro'
Type: AWS::ApiGateway::RestApi
Properties:
...
MyFunction:
Type: AWS::Lambda::Function
Resources:
MyBucket:
Type: AWS::S3::Bucket
'Fn::Transform':
Name: 'MyMacro'
MyApi:
Type: AWS::ApiGateway::RestApi
Properties:
...
MyFunction:
Type: AWS::Lambda::Function
Fn::Transform:
=> process all sibling elements
use macros | scope | parameter
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 8
Transform section:
=> process the
whole template
Transform: 'MyMacro'
Parameters:
...
Resources:
MyBucket:
Type: AWS::S3::Bucket
MyApi:
Type: AWS::ApiGateway::RestApi
...
Outputs:
use macros | scope | parameter
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 9
Transform section:Transform: 'MyMacro'
...
'Fn::Transform':
Name: 'MyMacro'
Parameters:
one: 'bar'
two: 23
three: false
string, number, boolean
unprocessed / not evaluated
Fn:Transform:
not possible
use macros | scope | parameter
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de
AWS provided Macros | AWS::Include | AWS::Serverless
10
maintained by AWS
globally available
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de
AWS provided Macros | AWS::Include | AWS::Serverless
11
Type: AWS::ApiGateway::RestApi
Properties:
Body:
'Fn::Transform':
Name: 'AWS::Include'
Parameters:
Location: s3://mybucket/swagger.yaml
Type: AWS::ApiGateway::RestApi
Properties:
Body:
swagger: '2.0'
host: 'example.org:80'
paths:
'/entity':
...
processed:
replace with
file content
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 12
Transform: AWS::Serverless-2016-10-31
Resources:
MyApi:
Type: AWS::Serverless::Api
Properties:
StageName: prod
...
Resources:
MyApi:
Type: AWS::ApiGateway::RestApi
Properties:
Body:
swagger: '2.0'
...
MyApiStage:
Type: AWS::ApiGateway::Stage
...
MyApiDeployment:
Type: AWS::ApiGateway::Deployment
processed
Serverless Application Model
- API
- Function
- SimpleTable
AWS provided Macros | AWS::Include | AWS::Serverless
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de
custom macros
13
announced September 2018
AWS::CloudFormation::Macro
custom processing on CFN templates
AWS Lambda powered transformations
Usecases:
- simple converting / validation
- creation of complete substacks
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de
limitations
14
only in regions where AWS Lambda is available
all AWS Lambda limits apply here as well
resulting fragment must be valid JSON
processed template must pass create & update Stack validation
max. template size is calculated after macro processing
no macros in substacks
no use of macros within macros
intrinsic functions are evaluated after macro processing
same account
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de
basic example: logging
15
log template fragment in CloudWatch
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 16
basic example: logging
create macro | use macro | demo
export function handler(event, context, callback){
console.log(event)
callback(null, {
requestId: event.requestId,
status: 'success',
fragment: event.fragment
})
}
Lambda function
index.ts
LoggingFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: index.handler
...
LoggingMacro:
Type: AWS::CloudFormation::Macro
Properties:
Name: 'MyLoggingMacro'
FunctionName: !GetAtt LoggingFunction.Arn
CloudFormation stack
template.yaml
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 17
create macro | use macro | demo
Transform: 'MyLoggingMacro'
Resources:
MyBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: 'cfn-test-mybucket'
'Fn::Transform':
Name: 'MyLoggingMacro'
Parameters:
one: 'bar'
two: 23
three: false
CloudFormation stack
using-template.yaml
basic example: logging
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 18
create macro | use macro | demo
-> demo <-
basic example: logging
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de
advanced example: monitoring
19
4 x CloudWatch::Alarm4 x Lambda 4 x Lambda
4 x CloudWatch::Alarm
Notification
> 70%
Timeout setting
template macro processed template
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de
4 x Lambda
advanced example: monitoring substack
20
template macro
4 x CloudWatch::Alarm4 x Lambda
Notification
> 70%
Timeout setting
1 x CloudFormation::Stack
processed template
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de
advanced example: monitoring substack
21
Stacks
??
??
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 22
conclusion
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 23
How would you use
macros?
2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 24
Thank you for your
attention.
xing.to/mnwk
mail@maiknowak.de

More Related Content

What's hot

Introduction to AWS Lambda with Python
Introduction to AWS Lambda with PythonIntroduction to AWS Lambda with Python
Introduction to AWS Lambda with Pythonadaplo
 
AWS Lambda Tutorial
AWS Lambda TutorialAWS Lambda Tutorial
AWS Lambda TutorialWhizlabs
 
Decompose the monolith into AWS Step Functions
Decompose the monolith into AWS Step FunctionsDecompose the monolith into AWS Step Functions
Decompose the monolith into AWS Step FunctionsbeSharp
 
When Should You Use AWS Lambda?
When Should You Use AWS Lambda?When Should You Use AWS Lambda?
When Should You Use AWS Lambda?Whizlabs
 
AWS ❤ SAM - Serverless on stage #9 (Milan, 20/02/2018)
AWS ❤ SAM - Serverless on stage #9 (Milan, 20/02/2018)AWS ❤ SAM - Serverless on stage #9 (Milan, 20/02/2018)
AWS ❤ SAM - Serverless on stage #9 (Milan, 20/02/2018)Francesco Lerro
 
Introduce AWS Lambda for newbie and Non-IT
Introduce AWS Lambda for newbie and Non-ITIntroduce AWS Lambda for newbie and Non-IT
Introduce AWS Lambda for newbie and Non-ITChitpong Wuttanan
 
AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the ...
AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the ...AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the ...
AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the ...Amazon Web Services
 
AWS Lambda Documentation
AWS Lambda DocumentationAWS Lambda Documentation
AWS Lambda DocumentationWhizlabs
 
AWS Multiple Account Management
AWS Multiple Account ManagementAWS Multiple Account Management
AWS Multiple Account ManagementYihui Xu
 
Getting started with AWS Lambda and the Serverless Cloud
Getting started with AWS Lambda and the Serverless CloudGetting started with AWS Lambda and the Serverless Cloud
Getting started with AWS Lambda and the Serverless CloudIan Massingham
 
How to Use AWS Lambda Layers and Lambda Runtime
How to Use AWS Lambda Layers and Lambda RuntimeHow to Use AWS Lambda Layers and Lambda Runtime
How to Use AWS Lambda Layers and Lambda RuntimeDonnie Prakoso
 
Functional programming-in-the-cloud
Functional programming-in-the-cloudFunctional programming-in-the-cloud
Functional programming-in-the-cloudGary Sieling
 
DevTalks Romania - Getting Started with AWS Lambda & the Serverless Cloud
DevTalks Romania - Getting Started with AWS Lambda & the Serverless CloudDevTalks Romania - Getting Started with AWS Lambda & the Serverless Cloud
DevTalks Romania - Getting Started with AWS Lambda & the Serverless CloudIan Massingham
 

What's hot (20)

Serverless Architecture
Serverless ArchitectureServerless Architecture
Serverless Architecture
 
Introduction to AWS Lambda with Python
Introduction to AWS Lambda with PythonIntroduction to AWS Lambda with Python
Introduction to AWS Lambda with Python
 
AWS Lambda Tutorial
AWS Lambda TutorialAWS Lambda Tutorial
AWS Lambda Tutorial
 
Decompose the monolith into AWS Step Functions
Decompose the monolith into AWS Step FunctionsDecompose the monolith into AWS Step Functions
Decompose the monolith into AWS Step Functions
 
When Should You Use AWS Lambda?
When Should You Use AWS Lambda?When Should You Use AWS Lambda?
When Should You Use AWS Lambda?
 
AWS ❤ SAM - Serverless on stage #9 (Milan, 20/02/2018)
AWS ❤ SAM - Serverless on stage #9 (Milan, 20/02/2018)AWS ❤ SAM - Serverless on stage #9 (Milan, 20/02/2018)
AWS ❤ SAM - Serverless on stage #9 (Milan, 20/02/2018)
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
Introduce AWS Lambda for newbie and Non-IT
Introduce AWS Lambda for newbie and Non-ITIntroduce AWS Lambda for newbie and Non-IT
Introduce AWS Lambda for newbie and Non-IT
 
AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the ...
AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the ...AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the ...
AWS April Webinar Series - AWS Lambda: Event-driven Code for Devices and the ...
 
AWS Lambda Documentation
AWS Lambda DocumentationAWS Lambda Documentation
AWS Lambda Documentation
 
AWS Multiple Account Management
AWS Multiple Account ManagementAWS Multiple Account Management
AWS Multiple Account Management
 
Deep Dive: AWS Lambda
Deep Dive: AWS LambdaDeep Dive: AWS Lambda
Deep Dive: AWS Lambda
 
Python on AWS Lambda
Python on AWS Lambda Python on AWS Lambda
Python on AWS Lambda
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
Serverless for Developers
Serverless for DevelopersServerless for Developers
Serverless for Developers
 
Getting started with AWS Lambda and the Serverless Cloud
Getting started with AWS Lambda and the Serverless CloudGetting started with AWS Lambda and the Serverless Cloud
Getting started with AWS Lambda and the Serverless Cloud
 
How to Use AWS Lambda Layers and Lambda Runtime
How to Use AWS Lambda Layers and Lambda RuntimeHow to Use AWS Lambda Layers and Lambda Runtime
How to Use AWS Lambda Layers and Lambda Runtime
 
AWS Lambda
AWS LambdaAWS Lambda
AWS Lambda
 
Functional programming-in-the-cloud
Functional programming-in-the-cloudFunctional programming-in-the-cloud
Functional programming-in-the-cloud
 
DevTalks Romania - Getting Started with AWS Lambda & the Serverless Cloud
DevTalks Romania - Getting Started with AWS Lambda & the Serverless CloudDevTalks Romania - Getting Started with AWS Lambda & the Serverless Cloud
DevTalks Romania - Getting Started with AWS Lambda & the Serverless Cloud
 

Similar to AWS CloudFormation Macros

IaC: Tools of the trade
IaC: Tools of the tradeIaC: Tools of the trade
IaC: Tools of the tradeMichael Pearce
 
Voxxed Athens 2018 - Serverless by Design
Voxxed Athens 2018 - Serverless by DesignVoxxed Athens 2018 - Serverless by Design
Voxxed Athens 2018 - Serverless by DesignVoxxed Athens
 
Intro To Serverless Application Architecture: Collision 2018
Intro To Serverless Application Architecture: Collision 2018Intro To Serverless Application Architecture: Collision 2018
Intro To Serverless Application Architecture: Collision 2018Amazon Web Services
 
re:Invent recap session 1: What's New with AWS Lambda
re:Invent recap session 1: What's New with AWS Lambda re:Invent recap session 1: What's New with AWS Lambda
re:Invent recap session 1: What's New with AWS Lambda Amazon Web Services
 
Building CICD Pipelines for Serverless Applications
Building CICD Pipelines for Serverless ApplicationsBuilding CICD Pipelines for Serverless Applications
Building CICD Pipelines for Serverless ApplicationsAmazon Web Services
 
[OPD 2019] Automated Defense with Serverless computing
[OPD 2019] Automated Defense with Serverless computing[OPD 2019] Automated Defense with Serverless computing
[OPD 2019] Automated Defense with Serverless computingOWASP
 
(SEC318) AWS CloudTrail Deep Dive
(SEC318) AWS CloudTrail Deep Dive(SEC318) AWS CloudTrail Deep Dive
(SEC318) AWS CloudTrail Deep DiveAmazon Web Services
 
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...DevOps_Fest
 
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...Amazon Web Services
 
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)Amazon Web Services
 
February 2016 Webinar Series - Introducing VPC Support for AWS Lambda
February 2016 Webinar Series - Introducing VPC Support for AWS LambdaFebruary 2016 Webinar Series - Introducing VPC Support for AWS Lambda
February 2016 Webinar Series - Introducing VPC Support for AWS LambdaAmazon Web Services
 
CloudWatch hidden features for debugging serverless application
CloudWatch hidden features for debugging serverless applicationCloudWatch hidden features for debugging serverless application
CloudWatch hidden features for debugging serverless applicationMarko (ServerlessLife)
 
Lamdba micro service using Amazon Api Gateway
Lamdba micro service using Amazon Api GatewayLamdba micro service using Amazon Api Gateway
Lamdba micro service using Amazon Api GatewayMike Becker
 
Unlocking Agility with the AWS Serverless Application Model (SAM)
Unlocking Agility with the AWS Serverless Application Model (SAM)Unlocking Agility with the AWS Serverless Application Model (SAM)
Unlocking Agility with the AWS Serverless Application Model (SAM)Amazon Web Services
 
Build and run applications without thinking about servers
Build and run applications without thinking about serversBuild and run applications without thinking about servers
Build and run applications without thinking about serversAmazon Web Services
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep DiveAmazon Web Services
 
Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...
Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...
Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...Chris Shenton
 
Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12
Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12
Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12Chris Shenton
 
Ansible Munich meetup (Feb 2019) - Automate Kubernetes with Ansible Operators...
Ansible Munich meetup (Feb 2019) - Automate Kubernetes with Ansible Operators...Ansible Munich meetup (Feb 2019) - Automate Kubernetes with Ansible Operators...
Ansible Munich meetup (Feb 2019) - Automate Kubernetes with Ansible Operators...Carol Chen
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Amazon Web Services
 

Similar to AWS CloudFormation Macros (20)

IaC: Tools of the trade
IaC: Tools of the tradeIaC: Tools of the trade
IaC: Tools of the trade
 
Voxxed Athens 2018 - Serverless by Design
Voxxed Athens 2018 - Serverless by DesignVoxxed Athens 2018 - Serverless by Design
Voxxed Athens 2018 - Serverless by Design
 
Intro To Serverless Application Architecture: Collision 2018
Intro To Serverless Application Architecture: Collision 2018Intro To Serverless Application Architecture: Collision 2018
Intro To Serverless Application Architecture: Collision 2018
 
re:Invent recap session 1: What's New with AWS Lambda
re:Invent recap session 1: What's New with AWS Lambda re:Invent recap session 1: What's New with AWS Lambda
re:Invent recap session 1: What's New with AWS Lambda
 
Building CICD Pipelines for Serverless Applications
Building CICD Pipelines for Serverless ApplicationsBuilding CICD Pipelines for Serverless Applications
Building CICD Pipelines for Serverless Applications
 
[OPD 2019] Automated Defense with Serverless computing
[OPD 2019] Automated Defense with Serverless computing[OPD 2019] Automated Defense with Serverless computing
[OPD 2019] Automated Defense with Serverless computing
 
(SEC318) AWS CloudTrail Deep Dive
(SEC318) AWS CloudTrail Deep Dive(SEC318) AWS CloudTrail Deep Dive
(SEC318) AWS CloudTrail Deep Dive
 
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
DevOps Fest 2019. Alex Casalboni. Configuration management and service discov...
 
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
AWS October Webinar Series - AWS Lambda Best Practices: Python, Scheduled Job...
 
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
AWS re:Invent 2016: What’s New with AWS Lambda (SVR202)
 
February 2016 Webinar Series - Introducing VPC Support for AWS Lambda
February 2016 Webinar Series - Introducing VPC Support for AWS LambdaFebruary 2016 Webinar Series - Introducing VPC Support for AWS Lambda
February 2016 Webinar Series - Introducing VPC Support for AWS Lambda
 
CloudWatch hidden features for debugging serverless application
CloudWatch hidden features for debugging serverless applicationCloudWatch hidden features for debugging serverless application
CloudWatch hidden features for debugging serverless application
 
Lamdba micro service using Amazon Api Gateway
Lamdba micro service using Amazon Api GatewayLamdba micro service using Amazon Api Gateway
Lamdba micro service using Amazon Api Gateway
 
Unlocking Agility with the AWS Serverless Application Model (SAM)
Unlocking Agility with the AWS Serverless Application Model (SAM)Unlocking Agility with the AWS Serverless Application Model (SAM)
Unlocking Agility with the AWS Serverless Application Model (SAM)
 
Build and run applications without thinking about servers
Build and run applications without thinking about serversBuild and run applications without thinking about servers
Build and run applications without thinking about servers
 
Serverless Development Deep Dive
Serverless Development Deep DiveServerless Development Deep Dive
Serverless Development Deep Dive
 
Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...
Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...
Deploying Serverless Cloud Optical Character Recognition in Support of NASA A...
 
Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12
Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12
Serverless OCR for NASA EVA: AWS Meetup DC 2017-12-12
 
Ansible Munich meetup (Feb 2019) - Automate Kubernetes with Ansible Operators...
Ansible Munich meetup (Feb 2019) - Automate Kubernetes with Ansible Operators...Ansible Munich meetup (Feb 2019) - Automate Kubernetes with Ansible Operators...
Ansible Munich meetup (Feb 2019) - Automate Kubernetes with Ansible Operators...
 
Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...Productionize Serverless Application Building and Deployments with AWS SAM - ...
Productionize Serverless Application Building and Deployments with AWS SAM - ...
 

More from Maik Wiesmüller

Serverless lessons learned #8 backoff
Serverless lessons learned #8 backoffServerless lessons learned #8 backoff
Serverless lessons learned #8 backoffMaik Wiesmüller
 
Serverless lessons learned #7 rate limiting
Serverless lessons learned #7 rate limitingServerless lessons learned #7 rate limiting
Serverless lessons learned #7 rate limitingMaik Wiesmüller
 
Serverless lessons learned #6 delivery strategies
Serverless lessons learned #6 delivery strategiesServerless lessons learned #6 delivery strategies
Serverless lessons learned #6 delivery strategiesMaik Wiesmüller
 
Serverless lessons learned #5 retries
Serverless lessons learned #5 retriesServerless lessons learned #5 retries
Serverless lessons learned #5 retriesMaik Wiesmüller
 
Serverless lessons learned #4 circuit breaker
Serverless lessons learned #4 circuit breakerServerless lessons learned #4 circuit breaker
Serverless lessons learned #4 circuit breakerMaik Wiesmüller
 
Serverless lessons learned #3 reserved concurrency
Serverless lessons learned #3 reserved concurrencyServerless lessons learned #3 reserved concurrency
Serverless lessons learned #3 reserved concurrencyMaik Wiesmüller
 
Serverless lessons learned #2 dead letter queues
Serverless lessons learned #2 dead letter queuesServerless lessons learned #2 dead letter queues
Serverless lessons learned #2 dead letter queuesMaik Wiesmüller
 
Serverless lessons learned #1 custom sdk timeouts
Serverless lessons learned #1 custom sdk timeoutsServerless lessons learned #1 custom sdk timeouts
Serverless lessons learned #1 custom sdk timeoutsMaik Wiesmüller
 
Serverless data lake architecture
Serverless data lake architectureServerless data lake architecture
Serverless data lake architectureMaik Wiesmüller
 

More from Maik Wiesmüller (9)

Serverless lessons learned #8 backoff
Serverless lessons learned #8 backoffServerless lessons learned #8 backoff
Serverless lessons learned #8 backoff
 
Serverless lessons learned #7 rate limiting
Serverless lessons learned #7 rate limitingServerless lessons learned #7 rate limiting
Serverless lessons learned #7 rate limiting
 
Serverless lessons learned #6 delivery strategies
Serverless lessons learned #6 delivery strategiesServerless lessons learned #6 delivery strategies
Serverless lessons learned #6 delivery strategies
 
Serverless lessons learned #5 retries
Serverless lessons learned #5 retriesServerless lessons learned #5 retries
Serverless lessons learned #5 retries
 
Serverless lessons learned #4 circuit breaker
Serverless lessons learned #4 circuit breakerServerless lessons learned #4 circuit breaker
Serverless lessons learned #4 circuit breaker
 
Serverless lessons learned #3 reserved concurrency
Serverless lessons learned #3 reserved concurrencyServerless lessons learned #3 reserved concurrency
Serverless lessons learned #3 reserved concurrency
 
Serverless lessons learned #2 dead letter queues
Serverless lessons learned #2 dead letter queuesServerless lessons learned #2 dead letter queues
Serverless lessons learned #2 dead letter queues
 
Serverless lessons learned #1 custom sdk timeouts
Serverless lessons learned #1 custom sdk timeoutsServerless lessons learned #1 custom sdk timeouts
Serverless lessons learned #1 custom sdk timeouts
 
Serverless data lake architecture
Serverless data lake architectureServerless data lake architecture
Serverless data lake architecture
 

Recently uploaded

Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...soniya singh
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionSolGuruz
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...stazi3110
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideChristina Lin
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxComplianceQuest1
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...OnePlan Solutions
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...gurkirankumar98700
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...MyIntelliSource, Inc.
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfkalichargn70th171
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)OPEN KNOWLEDGE GmbH
 

Recently uploaded (20)

Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
Russian Call Girls in Karol Bagh Aasnvi ➡️ 8264348440 💋📞 Independent Escort S...
 
Diamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with PrecisionDiamond Application Development Crafting Solutions with Precision
Diamond Application Development Crafting Solutions with Precision
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
Building a General PDE Solving Framework with Symbolic-Numeric Scientific Mac...
 
Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop SlideBuilding Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
Building Real-Time Data Pipelines: Stream & Batch Processing workshop Slide
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
A Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docxA Secure and Reliable Document Management System is Essential.docx
A Secure and Reliable Document Management System is Essential.docx
 
Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...Advancing Engineering with AI through the Next Generation of Strategic Projec...
Advancing Engineering with AI through the Next Generation of Strategic Projec...
 
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
(Genuine) Escort Service Lucknow | Starting ₹,5K To @25k with A/C 🧑🏽‍❤️‍🧑🏻 89...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
Steps To Getting Up And Running Quickly With MyTimeClock Employee Scheduling ...
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdfThe Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
The Essentials of Digital Experience Monitoring_ A Comprehensive Guide.pdf
 
Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)Der Spagat zwischen BIAS und FAIRNESS (2024)
Der Spagat zwischen BIAS und FAIRNESS (2024)
 

AWS CloudFormation Macros

  • 1. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de AWS CloudFormation Macros Custom processing on CloudFormation templates code examples: https://github.com/mnwk/cloudformation-macro-example contact: xing.to/mnwk mail@maiknowak.de
  • 2. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 2 Maik Nowak - IT-Freelancer Serverless IoT platform Tech stack: TypeScript CloudFormation Gitlab-CI AWS: ...
  • 3. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de CloudFormation and Macros 3 describe and provision infrastructure resourcesCFN template: IaC and automation JSON or YAML CFN macro: preprocessor for CFN templates transformation of template fragments
  • 4. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de macros? 4 # aws cloudformation deploy ?
  • 5. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de macros? 5 fragment local, CI, ... CloudFormation macro # aws cloudformation deploy template process each macro processed fragment transform fragment validation validation of the template macros are processed before changeset creation CFN console: “processed template” create changeset update stack preprocessing execution
  • 6. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 6 Resources: MyBucket: Type: AWS::S3::Bucket Properties: BucketName: MyBucket 'Fn::Transform': Name: 'MyMacro' local macros - Fn::Transform global macros - Transform section Transform: 'MyMacro' Resources: MyBucket: Type: AWS::S3::Bucket Properties: BucketName: MyBucket use macros | scope | parameter
  • 7. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 7 Resources: MyBucket: Type: AWS::S3::Bucket MyApi: 'Fn::Transform': Name: 'MyMacro' Type: AWS::ApiGateway::RestApi Properties: ... MyFunction: Type: AWS::Lambda::Function Resources: MyBucket: Type: AWS::S3::Bucket 'Fn::Transform': Name: 'MyMacro' MyApi: Type: AWS::ApiGateway::RestApi Properties: ... MyFunction: Type: AWS::Lambda::Function Fn::Transform: => process all sibling elements use macros | scope | parameter
  • 8. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 8 Transform section: => process the whole template Transform: 'MyMacro' Parameters: ... Resources: MyBucket: Type: AWS::S3::Bucket MyApi: Type: AWS::ApiGateway::RestApi ... Outputs: use macros | scope | parameter
  • 9. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 9 Transform section:Transform: 'MyMacro' ... 'Fn::Transform': Name: 'MyMacro' Parameters: one: 'bar' two: 23 three: false string, number, boolean unprocessed / not evaluated Fn:Transform: not possible use macros | scope | parameter
  • 10. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de AWS provided Macros | AWS::Include | AWS::Serverless 10 maintained by AWS globally available
  • 11. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de AWS provided Macros | AWS::Include | AWS::Serverless 11 Type: AWS::ApiGateway::RestApi Properties: Body: 'Fn::Transform': Name: 'AWS::Include' Parameters: Location: s3://mybucket/swagger.yaml Type: AWS::ApiGateway::RestApi Properties: Body: swagger: '2.0' host: 'example.org:80' paths: '/entity': ... processed: replace with file content
  • 12. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 12 Transform: AWS::Serverless-2016-10-31 Resources: MyApi: Type: AWS::Serverless::Api Properties: StageName: prod ... Resources: MyApi: Type: AWS::ApiGateway::RestApi Properties: Body: swagger: '2.0' ... MyApiStage: Type: AWS::ApiGateway::Stage ... MyApiDeployment: Type: AWS::ApiGateway::Deployment processed Serverless Application Model - API - Function - SimpleTable AWS provided Macros | AWS::Include | AWS::Serverless
  • 13. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de custom macros 13 announced September 2018 AWS::CloudFormation::Macro custom processing on CFN templates AWS Lambda powered transformations Usecases: - simple converting / validation - creation of complete substacks
  • 14. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de limitations 14 only in regions where AWS Lambda is available all AWS Lambda limits apply here as well resulting fragment must be valid JSON processed template must pass create & update Stack validation max. template size is calculated after macro processing no macros in substacks no use of macros within macros intrinsic functions are evaluated after macro processing same account
  • 15. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de basic example: logging 15 log template fragment in CloudWatch
  • 16. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 16 basic example: logging create macro | use macro | demo export function handler(event, context, callback){ console.log(event) callback(null, { requestId: event.requestId, status: 'success', fragment: event.fragment }) } Lambda function index.ts LoggingFunction: Type: AWS::Serverless::Function Properties: CodeUri: index.handler ... LoggingMacro: Type: AWS::CloudFormation::Macro Properties: Name: 'MyLoggingMacro' FunctionName: !GetAtt LoggingFunction.Arn CloudFormation stack template.yaml
  • 17. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 17 create macro | use macro | demo Transform: 'MyLoggingMacro' Resources: MyBucket: Type: AWS::S3::Bucket Properties: BucketName: 'cfn-test-mybucket' 'Fn::Transform': Name: 'MyLoggingMacro' Parameters: one: 'bar' two: 23 three: false CloudFormation stack using-template.yaml basic example: logging
  • 18. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 18 create macro | use macro | demo -> demo <- basic example: logging
  • 19. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de advanced example: monitoring 19 4 x CloudWatch::Alarm4 x Lambda 4 x Lambda 4 x CloudWatch::Alarm Notification > 70% Timeout setting template macro processed template
  • 20. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 4 x Lambda advanced example: monitoring substack 20 template macro 4 x CloudWatch::Alarm4 x Lambda Notification > 70% Timeout setting 1 x CloudFormation::Stack processed template
  • 21. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de advanced example: monitoring substack 21 Stacks ?? ??
  • 22. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 22 conclusion
  • 23. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 23 How would you use macros?
  • 24. 2018-11-01 AWS CloudFormation Macros @ AWS UG HH - mail@maiknowak.de 24 Thank you for your attention. xing.to/mnwk mail@maiknowak.de