Skip to main content

AWS Cloudformation deployer

Project description

https://img.shields.io/pypi/v/brume.svg https://img.shields.io/pypi/l/brume.svg https://img.shields.io/pypi/wheel/brume.svg https://img.shields.io/pypi/pyversions/brume.svg

Installation

brume is a Python package and it can be installed with Pip:

$ pip install brume

Usage

The current directory must contain a brume.yml configuration file.

Available commands

These commands always use the current AWS credentials and the stack name from the brume.yml file.

  • config: Print the current stack configuration based on the brume.yml file, with the variables interpolated.

  • create: Create the CloudFormation stack.

  • delete: Delete the CloudFormation stack.

  • deploy: Create or update the CloudFormation stack, if you only care about applying your changes and don’t want to know if the stack already exists or not (can be useful for automated deployments)

  • update: Update the existing CloudFormation stack.

  • upload: Upload CloudFormation templates to S3.

  • validate: Validate the CloudFormation templates that reside in local_path (in the YAML configuration) or the current directory.

The brume.yml file

The configuration file requires two configuration blocks stack and templates.

Stack

stack:
  stack_name: my-wordpress-website   # [REQUIRED] the name of the CloudFormation stack
  template_body: Main.cform          # local path to the main CloudFormation template
  template_url: https://my-bucket.s3.amazonaws.com/assets/cloudformation/Main.cform  # complete URL to the main CloudFormation template on S3

The template referenced in stack.template_body or stack.template_url is the entrypoint to your CloudFormation stack (the main or parent stack).

Templates

In case your stack is split between multiple templates, you need to upload the CloudFormation templates to S3 (e.g. using brume upload or the tool of your choice).

If you use brume upload, you need to tell brume where the templates are and where to put them. This is done via the templates section.

templates:
  s3_bucket: my-bucket            # [REQUIRED] name of the bucket in your account in which to store the templates
  s3_path: assets/cloudformation  # path of the S3 folder where the template are uploaded, defaults to `cloudformation`
  local_path: project/cfn         # local path where your CloudFormation templates are, defaults to `.`

Given the above configuration and if you have a Main.cform in project/cfn, the template would be uploaded to https://my-bucket.s3.amazonaws.com/assets/cloudformation/Main.cform.

Minimal example

region: eu-west-1

stack:
  stack_name: my-wordpress-website
  template_body: Main.cform

templates:
  s3_bucket: my-bucket

Complete example

brume.yml is in fact a Jinja2 template which means you can declare variables and reuse them in the template. You can also inject environment variables by calling {{ env('MY_VAR') }}.

Also, if the current directory is a git repository (if it contains a .git/ directory), brume offers two pre-defined variables: git_commit and git_branch. Their values are taken directly from the current repository.

region: {{ env('AWS_REGION') }}

{% set stack_name = '-'.join([env('PROJECT'), env('ENVIRONMENT'), env('CLASSIFIER')]) %}
stack:
  stack_name: {{ stack_name }}

  template_body: Main.cform
  capabilities: [ CAPABILITY_IAM ]
  on_failure: DELETE

  parameters:
    Project: '{{ env('PROJECT') }}'
    Platform: '{{ env('PLATFORM') }}'
    Classifier: '{{ env('CLASSIFIER') }}'
    GitCommit: '{{ git_commit }}'
    GitBranch: '{{ git_branch }}'

  tags:
    Project: '{{ env('PROJECT') }}'
    Platform: '{{ env('PLATFORM') }}'
    Classifier: '{{ env('CLASSIFIER') }}'

templates:
  s3_bucket: my_bucket
  s3_path: {{ stack_name }}
  local_path: cloudformation

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

brume-0.0.8.tar.gz (6.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

brume-0.0.8-py2-none-any.whl (10.5 kB view details)

Uploaded Python 2

File details

Details for the file brume-0.0.8.tar.gz.

File metadata

  • Download URL: brume-0.0.8.tar.gz
  • Upload date:
  • Size: 6.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for brume-0.0.8.tar.gz
Algorithm Hash digest
SHA256 7c428fcab55899c6873e8b4c104083040a0f8fe16db49f6d165fc8421f5e2ed1
MD5 bb565ac3265f25a11c0c7732da377c10
BLAKE2b-256 feef832e4465298c6c1787b3e3a66155516734108b9963e182e2534d07eaca33

See more details on using hashes here.

File details

Details for the file brume-0.0.8-py2-none-any.whl.

File metadata

File hashes

Hashes for brume-0.0.8-py2-none-any.whl
Algorithm Hash digest
SHA256 638508ebb6d09737024f45b25534da5b6aee7608aa309b30fcdd02cf5711bd71
MD5 847932ed95cc687366693ba1e6bccc9d
BLAKE2b-256 52f36e47b9127a32a8ad7e10467bbd8d71076694aa1ad0bd1f61ded946e1d25d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page