Skip to content

Reusable Makefile to bootstrap AWS::Serverless CloudFormation projects

License

Notifications You must be signed in to change notification settings

sbstjn/faas-makefile

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Reusable Makefile to bootstrap AWS::Serverless CloudFormation projects

Topics

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published