Custom CloudFormation

One of Architect’s chief responsibilities is to generate a standard CloudFormation document for deployment to AWS. This infrastructure-as-code document is available to Architect plugins to mutate however you see fit.

deploy.start plugins

deploy.start plugins allow you to process and mutate Architect-generated CloudFormation prior to deployment. This enables deep customization of any Architect default behavior, as well as allowing apps to extend into the entire AWS ecosystem of services.

Architect @plugins are implemented as a Node.js CJS module with the following function signature:

// Do something only for staging deployments
module.exports = { deploy: {
  start: async ({ arc, cloudformation, dryRun, inventory, stage }) => {
    if (stage !== 'staging') return

    let config = await getSomeConfig()
    cloudformation.Resources.whatever = config
    // The returned mutated CloudFormation document will be passed to any other `deploy.start` plugins in sequence
    return cloudformation
} }

Additional resources

Tip: preview generated CloudFormation without deploying by running arc deploy --dry-run and viewing sam.json