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"
      }
    }
  }
}

Subsections of Attini Deployment Plan

Definition

The DeploymentPlan Definition is an abstraction of AWS::Serverless::StateMachine and it supports Attini types and StepFunctions native Tasks like Optimized integrations for Step Functions and AWS SDK service integrations.

The DeploymentPlan Definition has the same CloudFormation limitations as the AWS::Serverless::StateMachine Definition.

You can write your DeploymentPlan Definition using Attini simplified syntax or Amazon state language

Subsections of Definition

Amazon State Language

A definition using Amazon state language that describes your deployment.

In addition to the Amazon state language types, the deployment plan can also use the Attini types.

This definition converts to a AWS State Machine Definition.

DeploymentPlan:
  StartAt: StateName
  States:
    StateName:
      Type: String
      # Optional configuration based on State Type
      Next: String
      End: Boolean

StartAt

Type: String

The step that the deployment plan should start with. This is the same as the StartAt property in the Amazon States Language

Required: Yes

States

Type: Map<Sting,Map>

This is the same as the States property in the Amazon States Language after the Attini-specific resources (ex AttiniCfn) have been converted into a valid Amazon States Language definition.

Make sure that the actions that you specify here are allowed by the deployment plan Role.

This map has limited support for CloudFormation functions.

  • Simple functions like Ref, Fn::GetAtt and Fn::Sub work like normal CloudFormation.
  • Complex functions like Fn::Join will need to use the DefinitionSubstitutions property.
  • Conditions are not supported. You can often work around this limitation using logic in your definition, example by using the Choice state.

Required: Yes

Type

Type: String

Any valid State type like Attini types, StateMachine Task, or other StateMachine States like Pass, Wait, Succeed, Fail, Choice or Parallel.

Next

Type: String

Name of the next step.

Required: Yes, if End is not configured

End

Type: Boolean

Marks the end of a branch execution.

Required: Yes, if End is not configured

Example
DeploymentPlan:
  StartAt: ManualApproval
  States:
    ManualApproval:
      Type: AttiniManualApproval
      Next: MyDatabaseStack

    MyDatabaseStack:
      Type: AttiniCfn
      Properties:
        StackName: database
        Template: /database.yaml
      End: True

Simplified Syntax

Attini simplified syntax lets you define your deployment plan using a List instead of Amazon state language. The steps will be executed in the order of the list.

In addition to a simple list of States, the simplified syntax also supports Parallel and Choice.

DeploymentPlan:
  - Name: String
    Type: String
    # Optional configuration based on State Type

Name

Type: String

Name of the State. This has to be unique within the deployment plan.

Type

Type: String

Any valid State type like Attini type, StateMachine Task, or other StateMachine States like Pass, Wait, Succeed and Fail.

Parallel and Choice are supported but have their own simplified syntax.

Example
DeploymentPlan:
  - Name: ManualApproval
    Type: AttiniManualApproval

  - Name: MyDatabaseStack
    Type: AttiniCfn
    Properties:
      StackName: database
      Template: /database.yaml

Parallel

This is a simplified syntax for the Parallel State.

The Parallel State outputs a list of the outputs from all its branches, therefore, it’s often desirable to use the AttiniMergeOutput Type after the Parallel State. This is done automatically when using the simplified syntax, assuming that the merge step has not been added manually.

DeploymentPlan:
  - Name: String
    Type: Parallel
    Branches: 
      - Name: String
        Type: String
Example
DeploymentPlan:
  - Name: MyParallelName
    Type: Parallel
    Branches:
      -
        - Name: Step_1_in_branch_1
          Type: AttiniLambdaInvoke
          Parameters:
            FunctionName: my-function
        - Name: Step_2_in_branch_1
          Type: AttiniSam
          Properties:
            Project:
              Path: /my-sam-app/
            StackName: my-sam-stack
      -
        - Name: Step_1_in_branch_2
          Type: AttiniRunnerJob
          Commands:
            - echo "hello world"

Choice

The Choice step will help you make choices depending on a condition. The condition can be based on data in the payload or CloudFormation configuration.

The simplified Choice differs from Amazon state language choice because the simplified syntax only allows for one comparison, while Amazon state language choice can have multiple.

DeploymentPlan:
  - Name: String
    Type: Choice
    Condition:
      Comparison
    IsTrue:
      - List<State>
    IsFalse:
      - List<State>

Condition

Type: Comparison

This Comparison is a direct translation for Amazon state language choice but without “Next”.

Required: Yes

IsTrue

Type: List<State>

A List of States that will be executed if the Condition is true.

Required: Yes

IsFalse

Type: List<State>

A List of States that will be executed if the Condition is false.

If IsFalse is omitted, the deployment will continue to the next step if the Condition is false (or end if it is the last step).

Required: No

Example
DeploymentPlan:
  - Name: IsDev?
    Type: Choice
    Condition:
      Variable: $.deploymentOriginData.environment
      StringEquals: dev
    IsTrue:
      - Name: RunLoadtest
        Type: AttiniRunnerJob
        Commands:
          - autocannon --amount 100 --connections 1 --connectionRate 10 --renderStatusCodes --bailout 1 https://my-site.com

Payload

When the deployment plan is executed, the Attini Framework will create a payload with a specific data structure that has to be respected for to the Attini types to function.

{
  "output": {
    "deploymentPlanStepName1": {
      "outputName": "String"
    },
    "deploymentPlanStepName2": {
      "outputPath": {
        "outputName": "String"
      }
    }
  },
  "environment": "String",
  "stackParameters": {
    "String": "String"
  },
  "customData": {},
  "deploymentOriginData": {
    "distributionName": "String",
    "deploymentTime": "epochTime",
    "deploymentSource": {
      "deploymentSourcePrefix": "String",
      "deploymentSourceBucket": "String"
    },
    "environment": "String",
    "distributionId": "String",
    "deploymentName": "String",
    "objectIdentifier": "String",
    "stackName": "String",
    "distributionTags": {
      "String": "String"
    },
    "version": "SemanticVersion",
    "samPackaged": "boolean"
  },
  "dependencies": {
    "distributionName": {
        "deploymentSourcePrefix": "String"
    }
  }
}

output

Type: Map<Map<String,String>> || Map<Map<Map<String,String>>>

This object contains outputs from previous steps. The first key under output references the State name of a previous step.

In simple scenarios, for example an AttiniCfn step, this section will just contain a key: value map from a CloudFormation stack output.

In more complex scenarios, for example when AttiniCdk step deploys multiple CloudFormation stacks, you might need an extra level in the output data structure to separate between different stacks.

environment

Type: String

The current environment.

stackParameters

Type: Map<String,String>>

The parameters for the Init Deploy stack.

customData

Type: Map<String,Map<>>

Under this field, you can add whatever data you need and the Attini Framework resources will pass it along. If data is given to the deployment plan state machine input, the input will end up under this field.

deploymentOriginData

Type: DeploymentOriginData

This object contains information about the deployment origin data.

dependencies

Type: Map<String,Map<String,String>>

If your distribution has a dependency, this data will tell you where to find the output from your dependency’s latest successful deployment.

Subsections of Payload

DeploymentOriginData

{
  "deploymentOriginData": {
    "distributionName": "String",
    "deploymentTime": "epochTime",
    "deploymentSource": {
      "deploymentSourcePrefix": "String",
      "deploymentSourceBucket": "String"
    },
    "environment": "String",
    "distributionId": "String",
    "deploymentName": "String",
    "objectIdentifier": "String",
    "stackName": "String",
    "distributionTags": {
      "String": "String"
    },
    "version": "SemanticVersion",
    "samPackaged": "boolean"
  }
}

distributionName

Type: String

The distribution name.

deploymentTime

Type: String

The time in epoch milliseconds that the Attini distribution was deployed to this environment.

deploymentSource

Type: deploymentSource

A Map containing data needed to find artifacts related to this deployment.

environment

Type: String

The current environment.

distributionId

Type: String

The distribution id.

deploymentName
Type: String An AWS Account and Region unique name for the deployment in the format {environment}-{distributionName}.

objectIdentifier

Type: String

The S3 key for the S3 object key and version (distribution) that triggered the deployment.

stackName

Type: String

The name of the Init Deploy CloudFormation stack name.

distributionTags

Type: Map<String,String>

The distribution tags from attini-config.

version

Type: String

The distribution semantic version.

samPackaged

Type: Boolean

If this is true, Attini has done a SAM Package due to a AttiniSam step in the deployment plan.

Subsections of DeploymentOriginData

DeploymentSource

{
  "deploymentSource": {
    "deploymentSourcePrefix": "String",
    "deploymentSourceBucket": "String"
  }
}

deploymentSourcePrefix

Type: String

The s3 bucket prefix for the distribution files, find more info here.

deploymentSourceBucket

Type: String

The s3 bucket for the distribution files, find more info info here.

Types

The deployment plan is built on AWS StepFunction and follows the format of AWS State Language. That means that any State Types supported by StepFunction are also supported in the deployment plan. However, Attini also supports some additional types in order to better support a deployment workflow.

Subsections of Types

AttiniCdk

To simplify deployments of AWS CDK Projects Attini provides the AttiniCdk type.

AttiniCdk uses the CDK CLI on an Attini runner job to perform the deployment, so you can optionally configure your own AWS IAM Role and container image. This way your deployment can follow the principle of least privilege and use any software versions you need.

AttiniCdk will register all the CDK stacks with Attini, so that your CDK stacks will be taken into consideration by the attini ops rogue-stacks report.

Because the AttiniCdk uses the CDK CLI to do the deployment, most configuration options will map to a CDK CLI option. If the configuration is omitted, the CDK CLI default behavior will apply, unless otherwise specified in the docs.

Non-default behavior
  1. --require-approval never will be used because the standard approval makes no sense when the deployment isn’t executed from your local workstation. If you want manual approval for changes, please follow this guide.
  2. --progress events will be used.
Type: AttiniCdk
Properties:
    Runner: String
    Path: String
    App: String
    Diff:
        Enabled: Boolean
    Environment: Map<String,String>
    Stacks: List<String>
    Context: Map<String,String>
    Plugins: List<String>
    StackConfiguration: List<CdkParameters>
    Build: String
    BuildExclude: List<String>
    Exclusively: Boolean
    NotificationArns: List<String>
    Force: Boolean
    RoleArn: String

Runner

Type: String

Reference a Attini::Deploy::Runner recourse, find more information here.

Required: No

Path

Type: String

Location of your CDK project directory inside your Attini distribution.

Required: Yes

App

Type: String

This property is passed to the --app option in the CDK CLI.

If your project has a cdk.json file with the "app" property configured, this is not needed.

Required: No

Diff

Type: Diff

Required: No

Environment

Type: Map<String,String>

This property lets you set environment variables on the container that will deploy the CDK project. This way, the CDK project can get data from the deployment plan payload.

Your code can access these environment variables directly, via the Context configuration, or the StackConfiguration (parameters).

Example
Type: AttiniCdk
Properties:
    Path: my-app
    Environment:
      ENV.$: $.environment
      VPC_ID.$: $.output.vpc.id

Required: No

Stacks

Type: List<String>

The Stacks in your CDK project to deploy. If omitted, the --all option in the CDK CLI will be used.

Required: No

Default: All

Context

Type: Map<String,String>

This property is passed to the --context option in the CDK CLI.

Example
Type: AttiniCdk
Properties:
    Path: my-app
    Context:
      vpd_id: $.output.vpc.id

Required: No

Plugins

Type: List<String>

This property is passed to the --plugin option in the CDK CLI.

Required: No

StackConfiguration

Type: List<CdkParameters>

This property is passed to the --parameters option in the CDK CLI.

Required: No

Build

Type: String

This property is passed to the --build option in the CDK CLI.

Example
Type: AttiniCdk
Properties:
    Path: my-app
    Build: |
      echo "My build commands"
      npm install      

Required: No

BuildExclude

Type: List<String>

This property is passed to the --build-exclude option in the CDK CLI.

Required: No

NotificationArns

Type: List<String>

This property is passed to the --notification-arns option in the CDK CLI.

Required: No

Force

Type: Boolean

This property is passed to the --force option in the CDK CLI.

Required: No

RoleArn

Type: String

This property is passed to the --role-arn option in the CDK CLI.

Required: No

Subsections of AttiniCdk

CdkParameters

StackConfiguration:
    - StackName: String
      Parameters: Map<String,String>

StackName

Type: String

The stack that the parameter should be applied to, this is only required if the CDK App has more than one stack.

Required: No

Parameters

Type: Map<String,String>

Key and Value map with the parameters for your stack.

Required: Yes

Example
StackConfiguration:
    - StackName: MyStackName
      Parameters:
          VpcId: $.output.vpc.id

Diff

Diff:
  Enabled: Boolean

Enabled

Type: Boolean

If set to true, the deployment plan will perform a cdk diff, and if there is a change, it will require manual approval.

Required: Yes

AttiniCfn

AttiniCfn will create, update, or delete a CloudFormation stack.

See more information about the configuration options here.

Note

If a stack is in “ROLLBACK_COMPLETE” state, and you re-run the deployment plan, the stack will be deleted and recreated. The “ROLLBACK_COMPLETE” state only occurs after a failed creation, and the rollback has deleted all the resources in the stack.

Type: AttiniCfn
Properties:
    Template: String
    StackName: String
    ConfigFile: String
    Parameters: Map<String,String>
    Tags: Map<String,String>
    StackRoleArn: String
    ExecutionRoleArn: String
    Region: String
    OutputPath: String
    Variables: Map<String,String>
    Action: String
    EnableTerminationProtection: Boolean

Template

Type: String

The path to the CloudFormation template. Can either be:

  1. A path to a file in the distribution.
  2. A URL to a public S3 file, starting with https://.
  3. An S3 path, starting with s3://.

Required: Yes (can be configured in the ConfigFile)

StackName

Type: String

AWS API compatibility: This property is passed directly to the StackName property of the CreateStack or UpdateStack API call.

Required: Yes (can be configured in the ConfigFile)

ConfigFile

Type: String

This is a reference to a JSON or a YAML file in the distribution.

Note

Public HTTPS endpoints, ex https://path/to/my/parameters.json does not work for configuration files.

Find more info in the CloudFormation configuration documentation

Required: No

Parameters

Type: Map<String, String>

The CloudFormation parameters, find more info in the CloudFormation configuration documentation

Required: No (can be configured in the ConfigFile)

Tags

Type: Map<String,String>

The CloudFormation stack tags.

Required: No (can be configured in the ConfigFile)

StackRoleArn

Type: String

Arn of the StackRole, find more info here: AWS CloudFormation service role

Note

This IAM Role has to be in the same AWS Account that the CloudFormation stack is deployed in, so if “ExecutionRoleArn” is in a different AWS account, this “StackRoleArn” has to be in the same account as the “ExecutionRoleArn” If the “StackRoleArn” is in a different AWS Account then the “ExecutionRoleArn” you will receive a “Cross-account pass role is not allowed.” error.

Find more information about the security aspects of StackRoles here

Required: Conditional (can be configured in the ConfigFile)

Info

If the parameter “GiveAdminAccess” in attini-setup is false, this parameter or ExecutionRoleArn is required.

ExecutionRoleArn

Type: String

The role that you want to be assumed when the Attini Framework deploys the CloudFormation stack. This can be useful if you are:

The ExecutionRole has to trust the attini action default role arn:aws:iam::{AccountId}:role/attini/attini-action-role-{Region} so that it can be assumed.

Example trust relationship policy:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": [
          "arn:aws:iam::111111111111:role/attini/attini-action-role-eu-west-1"
        ]
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
Note

If you configure an execution role in another account or region, the Attini Framework will use a polling pattern to verify the state of the stack, this makes the deployment plan execution slower, and it can lead to throttling issues if it’s used a lot.

Find more information about the security aspects of ExecutionRoles here.

Required: No (can be configured in the ConfigFile)

Default: arn:aws:iam::{AccountId}:role/attini/attini-action-role-{Region}

Region

Type: String

Configure the region you want the CloudFormation stack in.

Note

If you configure a Region other than the current region the Attini Framework will use a polling pattern to verify the state of the stack. This makes the deployment plan execution slower, and it can lead to throttling issues if it's used a lot.

Required: No

Default: Current region

OutputPath

Type: String

If you need an extra level of separation for your payload output, you can use OutputPath. This is useful if you need to have multiple output sections from one step, example when you use AttiniMap.

If you, for example, have a State name buzz and an OutputPath: foo the output payload will look like this:

{
  "output": {
    "buzz": {
      "foo": {
        "OutputKey": "OutputValue"
      }
    }
  }
}

Required: No (can be configured in the ConfigFile)

Variables

Type: Map<String,String>

If your step has a ConfigFile configured, you can use Variables to pass values from your deployment plan payload into the file.

If you, for example, have an AttiniCfn State with the following config:

StateName:
  Type: AttiniCfn
  Properties:
    Template: /ecs-service.yaml
    ConfigFile: /ecs-config.yaml
    Variables:
      Environment: !Ref AttiniEnvironmentName
      DatabasePort.$: $.output.Database.Port
      StackRoleArn.$: $.output.StackRoles.EcsStackRole
    StackName: ecs-service

Your ConfigFile can look like this:

stackRoleArn: ${StackRoleArn}
parameters:
  ServiceName: ${Environment}-my-ecs-service
  DatabasePort: ${DatabasePort}
Note

By using Variables you can replace or manipulate any AttiniCfn configuration except for the ConfigFile path.

Required: No (can be configured in the ConfigFile)

Action

Type: String

Specify if the stack should be deployed (created/updated), or deleted.

Allowed values: Deploy | Delete

Required: No (can be configured in the ConfigFile)

Default: Deploy

EnableTerminationProtection

Type: Boolean

Specify if termination protection should be enabled for the stack.

Note

When first creating a stack, this is an atomic operation. However when updating an existing stack, the termination protection will be updated before the rest of the stack. This means that if the stack update fails and a rollback is performed, the termination protection will not be rolled back with the rest of the updates.

Required: No (can be configured in the ConfigFile)

Default: false

AttiniImport

The Attini import step can be used for importing data from different sources. A common use case for this type is reading data from the output of another distribution. For example, you could have a distribution responsible for setting up a network that exposes a VPC id. Then the VPC-id can be imported by other deployment plans.

Type: AttiniImport
Properties:
    SourceType: String
    Source: S3Source | DistributionSource
    Mapping: Map<String,String>
    ExecutionRoleArn: String

SourceType

Type: String

Specifies what kind of source should be used.

Allowed values: Distribution | S3

Required: Yes

Source

Type: S3Source | DistributionSource

Different sources require different information in order to import them. For example, S3 needs a bucket and key while a distribution needs the name of the distribution.

Which Source you need is decided by the SourceType.

Required: Yes

Mapping

Type: Map<String,String>

A key/value map where the value is a path to a value in the imported document. The path follows the JSONPath syntax. The value on the path will be included in the output of the step under the same key name as the mapping.

For example the following JSON source:

{
  "my-service-endpoint": "https://some-endpoint.com"
}

With the following mapping:

endpoint: $.my-service-endpoint

Would produce the following output for the step in the deployment plan payload.

{
  "endpoint": "https://some-endpoint.com"
}

Required: Yes

ExecutionRoleArn

Type: String

The arn of the execution role that should be used for accessing the source. At the moment only needed for the S3 source type if Attini does not have access to the S3 Bucket.

Required: No

Default: None

Subsections of AttiniImport

DistributionSource

Used when the source of the import should be another distribution deployed in the environment. Before a distribution can import the output of another distribution, it first needs to be declared as a dependency in the attini-config file.

Source:
  Name: String

Name

Type: String

The name of the distribution.

Required: Yes

Example
SourceType: Distribution
Source:
    Name: network

S3Source

Used when the source of the import should be a file on S3. The file must be in either a JSON or a YAML format.

Key: String
Bucket: String

Key

Type: String

The S3 Key of the document to import.

Required: Yes

Bucket

Type: String

The S3 Bucket where the document is located.

Required: Yes

Example
SourceType: S3
Source:
    Key: /my/s3/key.json
    Bucket: my-bucket

AttiniLambdaInvoke

AttiniLambdaInvoke will call a Lambda function while preserving the payload for subsequent steps. This is an abstraction of the Amazon state language Lambda integration and all parameters are supported.

The difference between using StepFunction native Lambda invoke functionality and the AttiniLambdaInvoke is that AttiniLambdaInvoke will automatically configure the Lambda output to comply with the deployment plan payload structure.

Type: AttiniLambdaInvoke
Parameters:
  FunctionName: String

FunctionName

Type: String

Lambda function name.

Required: Yes

Payload

Type: Map<String,String

This is passed directly to the Payload configuration in the Step Functions, and it works the same way.

By default, the entire deployment plan payload will be passed as input to the Lambda function.

Required: No

Example
Type: AttiniLambdaInvoke
Parameters:
  FunctionName: my-lambda-function

AttiniManualApproval

AttiniManualApproval

The manual approval step will pause the deployment plan and wait for confirmation before continuing. The deployment can be resumed by running the attini deploy continue command with the Attini CLI.

Type: AttiniManualApproval
Example
  ExampleDeployment:
    Type: Attini::Deploy::DeploymentPlan
    Properties:
      DeploymentPlan:
        - Name: WaitForApproval 
          Type: AttiniManualApproval

AttiniMap

Note

Experimental feature!

This is an abstraction of the Amazon state language Map that help you use AttiniCfn within a Map.

In an AttiniMap, your AttiniCfn will need to have OutputPath configured.

At the moment, it requires a list of S3 Objects keys that are served as input for each iteration. We are working on improving AttiniMap to make it more user-friendly.

This is passed directly the AWS StepFunction inline Map state, so you can find more information in its documentation.

Type: AttiniMap
ItemsPath: String
MaxConcurrency: Number
Iterator:
  StartAt: StateName
  States:
    StateName:
      Type: AttiniCfn

AttiniMergeOutput

Type: AttiniMergeOutput

Some AWS StepFunction types return a list instead of an object, for example, Parallel or Map.

To make the payload easier to work with, the merge step can merge all the data in the list into one object.

Info

This is added automatically after a parallel step when using the simplified syntax.

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

Resources:

  ExampleDeploy:
    Type: Attini::Deploy::DeploymentPlan
    Properties:
      DeploymentPlan:
        StartAt: Step1
        States:
          Step1:
            Type: Parallel
            Next: MergeOutputsFromStep1
            Branches:
              -
                StartAt: Stack1
                States:
                  Stack1:
                    Type: AttiniCfn
                    Properties:
                      Template: /template-1.yaml
                      StackName: stack-1
                    End: true
              -
                StartAt: Stack2
                States:
                  Stack2:
                    Type: AttiniCfn
                    Properties:
                      Template: /template-2.yaml
                      StackName: stack-2
                    End: true

          MergeOutputsFromStep1:
            Type: AttiniMergeOutput
            Next: Step2

          Step2:
            Type: AttiniCfn
            Properties:
              Template: /template-3.yaml
              StackName: stack-3
            End: true

AttiniRunnerJob

The AttiniRunnerJob is a quick and cost-efficient way to run shell commands using a container.

Find detailed information about the Attini::Deploy::Runner type here.

Find information about the Attini Runner architecture here.

Type: AttiniRunnerJob
Properties:
  Runner: String
  Environment: Map<String,String>
  Commands: List<String>

Runner

Type: String

Reference a Attini::Deploy::Runner recourse, find more information here.

Default: Attini default runner

Required: No

Environment

Type: Map<String,String>

This property lets you set environment variables on the Runner.

Example
Type: AttiniRunnerJob
Properties:
  Environment:
    ENV.$: $.environment
    VPC_ID.$: $.output.vpc.id
  Commands:
    - echo ${VPC_ID}

Required: No

Commands

Type: List<String>

List of shell commands that runs the job.

These commands are run with set -eo pipefail configuration so that they fail quickly. To revert this configuration (and ignore errors in your scrips), begin your commands with the line: set +eo pipefail.

Note

These strings can NOT integrate with the payload through Amazon state language using the $. syntax or its intrinsic functions.

If you need these commands to integrate with the payload, see the “Environment” configuration or Attini runner input and output.

Required: Yes

Example
HelloWorldRunner:
  Type: Attini::Deploy::Runner
  Properties:
    TaskDefinitionArn: !Ref RunnerTaskDefinition
    EcsCluster: test
    AwsVpcConfiguration:
      Subnets:
          - "subnet-aaaaaaaa"
          - "subnet-bbbbbbbb"
          - "subnet-cccccccc"
      SecurityGroups:
          - 'sg-11111111'
      assignPublicIp: ENABLED


ExampleDeployment:
  Type: Attini::Deploy::DeploymentPlan
  Properties:
    DeploymentPlan:
      - Name: Step1
        Type: AttiniRunnerJob
        Properties:
          Runner: HelloWorldRunner
          Commands:
            - echo "my shell commands"

AttiniSam

To simplify the use of the AWS Serverless Application Model (SAM) Attini will automatically build and package your SAM Applications if they are defined in the deployment plan using this (AttiniSam) type.

Attini will package the SAM App and use AttiniCfn to deploy it, meaning that most configurations will work the same way.

For more information on how Attini manages SAM Apps, see Attini and AWS SAM.

Type: AttiniSam
Properties:
    Project:
        Path: String
        Template: String
        BuildDir: String
    StackName: String
    ConfigFile: String
    Parameters: Map<String,String>
    Tags: Map<String,String>
    StackRoleArn: String
    ExecutionRoleArn: String
    Variables: Map<String,String>
    Action: String
    EnableTerminationProtection: Boolean
Note

Region from AttiniCfn is not supported because CloudFormation requires Lambda code to be stored in the same region as its being deployed to. The Attini Framework will package the SAM Application into an S3 Bucket in your current region only.

Attini does not support packaging AWS Lambda function with container images.

Project

Type: SamProject

Required: Yes

StackName

See StackName in AttiniCfn.

ConfigFile

See ConfigFile in AttiniCfn.

Parameters

See Parameters in AttiniCfn.

Tags

See Tags in AttiniCfn.

StackRoleArn

See StackRoleArn in AttiniCfn.

ExecutionRoleArn

See ExecutionRoleArn in AttiniCfn.

Variables

See Variables in AttiniCfn.

Action

See Action in AttiniCfn.

EnableTerminationProtection

See EnableTerminationProtection in AttiniCfn.

Subsections of AttiniSam

Project

Project:
  Path: String
  Template: String
  BuildDir: String

Path

Type: String

The path in your Attini project.

Required: Yes

BuildDir

Type: String

The path to a directory where the built artifacts are stored. This directory and all of its content are removed with this option.

See -b and --build-dir options in AWS SAM CLI build documentation.

Required: No

Default: .aws-sam/build

Template

Type: String

The path and file name of AWS SAM template file.

See -t, --template and --template-file option in AWS SAM CLI build documentation.

Required: No

Default: template.yaml

Example
Project:
  Path: /sam-app