Attini Deployment Plan

The Attini deployment plan is an abstraction on the AWS::Serverless::StateMachine CloudFormation resource. It also extends the StateMachine with features that make it an excellent deployment orchestrator. It integrates with the deployment source files, the Attini CLI, and supports the Attini State Types.

You can define your deployment plan in a programming language using the Attini CDK Constructs.

The deployment plan can ONLY be created in the Attini init deploy stack.

The deployment plan template requires the following Transform configuration:

AWSTemplateFormatVersion: "2010-09-09"
Transform:
  - AttiniDeploymentPlan
  - AWS::Serverless-2016-10-31

Attini::Deploy::DeploymentPlan

Type: Attini::Deploy::DeploymentPlan
Properties:
  DefinitionSubstitutions: Map
  PayloadDefaults: Map
  RoleArn: String
  Policies: String | List | Map
  PermissionsBoundary: String
  Tags: Map<String,String>
  DefaultRunner: String
  DeploymentPlan: DeploymentPlan Definition

DefinitionSubstitutions

Type: Map<String,String|Map>

AWS SAM compatibility: This property is passed directly to the DefinitionSubstitutions property of an AWS::Serverless::StateMachine resource.

This is useful if you want to use AWS CloudFormations Condition functions when you build your deployment plan. This can also be used for Intrinsic functions but most of them (ex Fn::Sub and Ref) can also be written straight in the deployment plan.

Required: No

PayloadDefaults

Type: Map<String,String|Map>

A method to create initial default values for the deployment payload.

These default values can be used to avoid runtime errors when reading missing values from the payload.

The PayloadDefaults currently only work in the “output” section of the payload.

Example
Properties:
  PayloadDefaults:
    output:
      MyStepName:
        MyOutput: "MyValue"

This value can be referenced in DeploymentPlan with the JSON string: $.output.MyStepName.MyOutput.

MyValue can be overwritten by a step called MyStepName if it outputs a key called MyOutput.

Required: No

RoleArn

Type: String

AWS SAM compatibility: This property is passed directly to the Role property of an AWS::Serverless::StateMachine resource.

You provide either a RoleArn or Policies.

Default: arn:aws:iam::{Account}:role/attini/attini-deployment-plan-default-states-service-role-{Region}

Required: Conditional

Info

If the parameter CreateDeploymentPlanDefaultRole on the attini-setup CloudFormation stack is false, then this is or Policies required.

Policies

Type: String | List | Map

AWS SAM compatibility: This property is passed directly to the Policies property of an AWS::Serverless::StateMachine resource.

You provide either a RoleArn or Policies.

Required: Conditional

Info

If the parameter CreateDeploymentPlanDefaultRole on the attini-setup CloudFormation stack is false, then this is or RoleArn required.

PermissionsBoundary

Type: String

AWS SAM compatibility: This property is passed directly to the PermissionsBoundary property of an AWS::Serverless::StateMachine resource.

This will only work if you create the IAM Role using the Policies configuration.

Required: No

Tags

Type: Map<String,String>

AWS SAM compatibility: This property is passed directly to the Tags property of an AWS::Serverless::StateMachine resource.

Required: No

DefaultRunner

Type: String

Override Attini’s default runner.

Note

If this is configured, it will be used for all deployment plan types which are built on-top of the Attini runner like AttiniCfn and AttiniSam. So you have to make sure that all the required software is installed on the docker image you configure.

Required: No

DeploymentPlan

Type: DeploymentPlan Definition

You can define your deployment plan in different 2 ways:

  1. Simplified syntax (List)
  2. Amazon state language (Map)

Required: Yes

Transformed resources

A Attini::Deploy::DeploymentPlan resource transforms into multiple CloudFormation resources that together create your deployment plan.

In this example, you can see how the transformed template will look.

Original template
AWSTemplateFormatVersion: "2010-09-09"
Transform:
  - AttiniDeploymentPlan
  - AWS::Serverless-2016-10-31

Resources:
  PublicWebsite:
    Type: Attini::Deploy::DeploymentPlan
    Properties:
      DeploymentPlan:
        ...

Outputs:
  DeploymentSfnPlanArn:
    Description: The arn of the StepFunction generated by PublicWebsite
    Value: !Ref AttiniDeploymentPlanSfnPublicWebsite
Transformed template
{
  "AWSTemplateFormatVersion": "2010-09-09",
  "Resources": {
    "AttiniDeploymentPlanSfnTriggerPublicWebsite": {
      "Type": "Custom::AttiniDeploymentPlanTrigger",
      "Properties": {
        "...": "..."
      }
    },
    "AttiniDeploymentPlanSfnPublicWebsite": {
      "Type": "AWS::StepFunctions::StateMachine",
      "Properties": {
        "...": "..."
      }
    },
    "AttiniPostExecutionActionsPublicWebsite": {
      "Type": "AWS::Events::Rule",
      "Properties": {
        "...": "..."
      }
    }
  },
  "Outputs": {
    "DeploymentSfnPlanArn": {
      "Description": "The arn of the StepFunction generated by PublicWebsite deployment plan",
      "Value": {
        "Ref": "AttiniDeploymentPlanSfnPublicWebsite"
      }
    }
  }
}