Skip to content
Reusable Makefile to bootstrap AWS::Serverless CloudFormation projects
Branch: master
Clone or download
Latest commit 0a9fc9b Apr 18, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.gitignore
CODE_OF_CONDUCT.md
LICENSE.md Initial commit. Feb 7, 2019
Makefile
README.md
infrastructure.yml chore: Update parameter handling Apr 18, 2019

README.md

Makefile for AWS::Serverless CloudFormation

MIT License FaaS.club FaaS Makefile

Reusable Makefile to bootstrap AWS::Serverless CloudFormation projects

Examples

Usage

# Download latest Makefile
$ > curl https://raw.githubusercontent.com/sbstjn/faas-makefile/master/Makefile -o .faas

# Create custom Makefile
$ > touch Makefile

# Configure Project Name
$ > echo "PROJECT_NAME = example" >> Makefile

# Include FAAS Makefile
$ > echo "\ninclude .faas" >> Makefile

# Add Example target
$ > echo "\nfoo:\n\t@ echo \"Done.\"" >> Makefile

# Run Example target
$ > make foo

Done.

# Run FaaS targets
$ > make configure package deploy

[…]

Configuration

The Makefile assumes a basic magic configuration. Everything can easily be changed, or overwritten.

PROJECT_NAME ?= undefined
PROJECT_SCOPE ?= faas
ENV ?= stable
PROJECT_ID ?= $(PROJECT_SCOPE)-$(PROJECT_NAME)-$(ENV)

AWS_BUCKET_NAME ?= $(PROJECT_SCOPE)-artifacts
AWS_STACK_NAME ?= $(PROJECT_ID)
AWS_REGION ?= eu-west-1
AWS_PROFILE ?= default 

FILE_TEMPLATE ?= infrastructure.yml
FILE_PACKAGE ?= ./dist/stack.yml
FILE_PARAMETERS ?= .parameters

CloudFormation Parameters

Per default, the content of a .parameters file is passed to the CloudFormation Stack as Parameters. The content of the file must be a valid environment variable configuration:

Foo=Bar
Baz=Qux

Targets

Tooling should make things easier and not be a barrier.

$ > make help

help         Show help
clean        Remove ./dist folder
configure    Create S3 Bucket for artifacts
package      Pack CloudFormation template
deploy       Deploy CloudFormation Stack
destroy      Delete CloudFormation Stack
describe     Show description of CloudFormation Stack
parameters   Show Parameters for CloudFormation Stack
outputs      List Outputs of CloudFormation Stack
variables    List Outputs of CloudFormation Stack as bash variables

CloudFormation Outputs

With make variables you can convert a Stack's Output into bash variables.

$ > make variables

OutputName=value

License

Feel free to use the code, it's released using the MIT license.

Contribution

You are welcome to contribute to this project! 😘

To make sure you have a pleasant experience, please read the code of conduct. It outlines core values and beliefs and will make working together a happier experience.

You can’t perform that action at this time.