class Workflow (construct)
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.ImageBuilder.Alpha.Workflow |
Go | github.com/aws/aws-cdk-go/awsimagebuilderalpha/v2#Workflow |
Java | software.amazon.awscdk.services.imagebuilder.alpha.Workflow |
Python | aws_cdk.aws_imagebuilder_alpha.Workflow |
TypeScript (source) | @aws-cdk/aws-imagebuilder-alpha ยป Workflow |
Implements
IConstruct, IDependable, IResource, IEnvironment, IWorkflow
Represents an EC2 Image Builder Workflow.
Example
const workflow = new imagebuilder.Workflow(this, 'EncryptedWorkflow', {
workflowType: imagebuilder.WorkflowType.BUILD,
kmsKey: new kms.Key(this, 'WorkflowKey'),
data: imagebuilder.WorkflowData.fromJsonObject({
schemaVersion: imagebuilder.WorkflowSchemaVersion.V1_0,
steps: [
{
name: 'LaunchBuildInstance',
action: imagebuilder.WorkflowAction.LAUNCH_INSTANCE,
onFailure: imagebuilder.WorkflowOnFailure.ABORT,
inputs: {
waitFor: 'ssmAgent',
},
},
{
name: 'CreateImage',
action: imagebuilder.WorkflowAction.CREATE_IMAGE,
onFailure: imagebuilder.WorkflowOnFailure.ABORT,
inputs: {
'instanceId': 'i-123',
},
},
{
name: 'TerminateInstance',
action: imagebuilder.WorkflowAction.TERMINATE_INSTANCE,
onFailure: imagebuilder.WorkflowOnFailure.CONTINUE,
inputs: {
'instanceId': 'i-123',
},
},
],
outputs: [
{
name: 'ImageId',
value: '$.stepOutputs.CreateImage.imageId',
},
],
}),
});
Initializer
new Workflow(scope: Construct, id: string, props: WorkflowProps)
Parameters
- scope
Construct - id
string - props
WorkflowProps
Construct Props
| Name | Type | Description |
|---|---|---|
| data | Workflow | The workflow document content that defines the image creation process. |
| workflow | Workflow | The phase in the image build process for which the workflow resource is responsible. |
| change | string | The change description of the workflow. |
| description? | string | The description of the workflow. |
| kms | IKey | The KMS key used to encrypt this workflow. |
| tags? | { [string]: string } | The tags to apply to the workflow. |
| workflow | string | The name of the workflow. |
| workflow | string | The version of the workflow. |
data
Type:
Workflow
The workflow document content that defines the image creation process.
workflowType
Type:
Workflow
The phase in the image build process for which the workflow resource is responsible.
changeDescription?
Type:
string
(optional, default: None)
The change description of the workflow.
Describes what change has been made in this version of the workflow, or what makes this version different from other versions.
description?
Type:
string
(optional, default: None)
The description of the workflow.
kmsKey?
Type:
IKey
(optional, default: an Image Builder owned key will be used to encrypt the workflow.)
The KMS key used to encrypt this workflow.
tags?
Type:
{ [string]: string }
(optional, default: None)
The tags to apply to the workflow.
workflowName?
Type:
string
(optional, default: a name is generated)
The name of the workflow.
workflowVersion?
Type:
string
(optional, default: 1.0.0)
The version of the workflow.
Properties
| Name | Type | Description |
|---|---|---|
| env | Resource | The environment this resource belongs to. |
| node | Node | The tree node. |
| stack | Stack | The stack in which this resource is defined. |
| workflow | string | The ARN of the workflow. |
| workflow | string | The name of the workflow. |
| workflow | string | The type of the workflow. |
| workflow | string | The version of the workflow. |
| static PROPERTY_INJECTION_ID | string | Uniquely identifies this class. |
env
Type:
Resource
The environment this resource belongs to.
For resources that are created and managed in a Stack (those created by
creating new class instances like new Role(), new Bucket(), etc.), this
is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like
Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be
different than the stack they were imported into.
node
Type:
Node
The tree node.
stack
Type:
Stack
The stack in which this resource is defined.
workflowArn
Type:
string
The ARN of the workflow.
workflowName
Type:
string
The name of the workflow.
workflowType
Type:
string
The type of the workflow.
workflowVersion
Type:
string
The version of the workflow.
static PROPERTY_INJECTION_ID
Type:
string
Uniquely identifies this class.
Methods
| Name | Description |
|---|---|
| apply | Apply the given removal policy to this resource. |
| grant(grantee, ...actions) | Grant custom actions to the given grantee for the workflow. |
| grant | Grant read permissions to the given grantee for the workflow. |
| to | Returns a string representation of this construct. |
| static from | Import an existing workflow given its ARN. |
| static from | Import an existing workflow by providing its attributes. |
| static is | Return whether the given object is a Workflow. |
applyRemovalPolicy(policy)
public applyRemovalPolicy(policy: RemovalPolicy): void
Parameters
- policy
RemovalPolicy
Apply the given removal policy to this resource.
The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you've removed it from the CDK application or because you've made a change that requires the resource to be replaced.
The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS
account for data recovery and cleanup later (RemovalPolicy.RETAIN).
grant(grantee, ...actions)
public grant(grantee: IGrantable, ...actions: string[]): Grant
Parameters
- grantee
IGrantableโ The principal. - actions
stringโ The list of actions.
Returns
Grant custom actions to the given grantee for the workflow.
grantRead(grantee)
public grantRead(grantee: IGrantable): Grant
Parameters
- grantee
IGrantableโ The principal.
Returns
Grant read permissions to the given grantee for the workflow.
toString()
public toString(): string
Returns
string
Returns a string representation of this construct.
static fromWorkflowArn(scope, id, workflowArn)
public static fromWorkflowArn(scope: Construct, id: string, workflowArn: string): IWorkflow
Parameters
- scope
Construct - id
string - workflowArn
string
Returns
Import an existing workflow given its ARN.
static fromWorkflowAttributes(scope, id, attrs)
public static fromWorkflowAttributes(scope: Construct, id: string, attrs: WorkflowAttributes): IWorkflow
Parameters
- scope
Construct - id
string - attrs
WorkflowAttributes
Returns
Import an existing workflow by providing its attributes.
The provided name must be normalized by converting all alphabetical characters to lowercase, and replacing all spaces and underscores with hyphens. You may not provide a dynamic expression for the workflowArn or workflowType
static isWorkflow(x)
public static isWorkflow(x: any): boolean
Parameters
- x
any
Returns
boolean
Return whether the given object is a Workflow.

.NET
Go
Java
Python
TypeScript (