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