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

Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...OnePlan Solutions
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletAndrea Goulet
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio, Inc.
 
Transformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksTransformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksJinanKordab
 
Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Maxim Salnikov
 
Encryption Recap: A Refresher on Key Concepts
Encryption Recap: A Refresher on Key ConceptsEncryption Recap: A Refresher on Key Concepts
Encryption Recap: A Refresher on Key Conceptsthomashtkim
 
Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Henry Schreiner
 
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4jGraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4jNeo4j
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...naitiksharma1124
 
Test Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdfTest Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdfkalichargn70th171
 
The Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test AutomationThe Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test AutomationElement34
 
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCAOpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCAShane Coughlan
 
Your Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | EvmuxYour Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | Evmuxevmux96
 
Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Chirag Panchal
 
A Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfA Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfICS
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024SimonedeGijt
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Andreas Granig
 

Recently uploaded (20)

Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
Optimizing Operations by Aligning Resources with Strategic Objectives Using O...
 
Community is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea GouletCommunity is Just as Important as Code by Andrea Goulet
Community is Just as Important as Code by Andrea Goulet
 
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-CloudAlluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
Alluxio Monthly Webinar | Simplify Data Access for AI in Multi-Cloud
 
Transformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with LinksTransformer Neural Network Use Cases with Links
Transformer Neural Network Use Cases with Links
 
Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?Prompt Engineering - an Art, a Science, or your next Job Title?
Prompt Engineering - an Art, a Science, or your next Job Title?
 
Encryption Recap: A Refresher on Key Concepts
Encryption Recap: A Refresher on Key ConceptsEncryption Recap: A Refresher on Key Concepts
Encryption Recap: A Refresher on Key Concepts
 
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
Abortion Pill Prices Germiston ](+27832195400*)[ 🏥 Women's Abortion Clinic in...
 
Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024Modern binary build systems - PyCon 2024
Modern binary build systems - PyCon 2024
 
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4jGraphSummit Milan - Visione e roadmap del prodotto Neo4j
GraphSummit Milan - Visione e roadmap del prodotto Neo4j
 
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
Abortion Pill Prices Mthatha (@](+27832195400*)[ 🏥 Women's Abortion Clinic In...
 
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
COMPUTER AND ITS COMPONENTS PPT.by naitik sharma Class 9th A mittal internati...
 
Test Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdfTest Automation Design Patterns_ A Comprehensive Guide.pdf
Test Automation Design Patterns_ A Comprehensive Guide.pdf
 
Abortion Clinic In Johannesburg ](+27832195400*)[ 🏥 Safe Abortion Pills in Jo...
Abortion Clinic In Johannesburg ](+27832195400*)[ 🏥 Safe Abortion Pills in Jo...Abortion Clinic In Johannesburg ](+27832195400*)[ 🏥 Safe Abortion Pills in Jo...
Abortion Clinic In Johannesburg ](+27832195400*)[ 🏥 Safe Abortion Pills in Jo...
 
The Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test AutomationThe Strategic Impact of Buying vs Building in Test Automation
The Strategic Impact of Buying vs Building in Test Automation
 
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCAOpenChain Webinar: AboutCode and Beyond - End-to-End SCA
OpenChain Webinar: AboutCode and Beyond - End-to-End SCA
 
Your Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | EvmuxYour Ultimate Web Studio for Streaming Anywhere | Evmux
Your Ultimate Web Studio for Streaming Anywhere | Evmux
 
Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024Food Delivery Business App Development Guide 2024
Food Delivery Business App Development Guide 2024
 
A Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdfA Deep Dive into Secure Product Development Frameworks.pdf
A Deep Dive into Secure Product Development Frameworks.pdf
 
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
Wired_2.0_CREATE YOUR ULTIMATE LEARNING ENVIRONMENT_JCON_16052024
 
Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 2024Automate your OpenSIPS config tests - OpenSIPS Summit 2024
Automate your OpenSIPS config tests - OpenSIPS Summit 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