Reusable Makefile to bootstrap AWS::Serverless CloudFormation projects
- AWS Serverless Application Model w/ Go
- AWS Serverless Application Model w/ Python
- AWS Serverless Application Model w/ TypeScript
# 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
[…]
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
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
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
With make variables
you can convert a Stack's Output into bash variables.
$ > make variables
OutputName=value
Feel free to use the code, it's released using the MIT license.
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.