class Ec2DeployAction
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.CodePipeline.Actions.Ec2DeployAction |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awscodepipelineactions#Ec2DeployAction |
Java | software.amazon.awscdk.services.codepipeline.actions.Ec2DeployAction |
Python | aws_cdk.aws_codepipeline_actions.Ec2DeployAction |
TypeScript (source) | aws-cdk-lib » aws_codepipeline_actions » Ec2DeployAction |
Implements
IAction
Extends
Action
CodePipeline Action to deploy EC2 instances.
Example
const sourceOutput = new codepipeline.Artifact();
const pipeline = new codepipeline.Pipeline(this, 'MyPipeline', {
pipelineType: codepipeline.PipelineType.V2,
});
const deployAction = new codepipeline_actions.Ec2DeployAction({
actionName: 'Ec2Deploy',
input: sourceOutput,
instanceType: codepipeline_actions.Ec2InstanceType.EC2,
instanceTagKey: 'Name',
instanceTagValue: 'MyInstance',
deploySpecifications: codepipeline_actions.Ec2DeploySpecifications.inline({
targetDirectory: '/home/ec2-user/deploy',
preScript: 'scripts/pre-deploy.sh',
postScript: 'scripts/post-deploy.sh',
}),
});
const deployStage = pipeline.addStage({
stageName: 'Deploy',
actions: [deployAction],
});
Initializer
new Ec2DeployAction(props: Ec2DeployActionProps)
Parameters
- props
Ec2Deploy Action Props
Properties
| Name | Type | Description |
|---|---|---|
| action | Action | The simple properties of the Action, like its Owner, name, etc. |
actionProperties
Type:
Action
The simple properties of the Action, like its Owner, name, etc.
Note that this accessor will be called before the bind callback.
Methods
| Name | Description |
|---|---|
| bind(scope, stage, options) | The callback invoked when this Action is added to a Pipeline. |
| on | Creates an Event that will be triggered whenever the state of this Action changes. |
| protected bound(scope, stage, options) | This is a renamed version of the IAction.bind method. |
bind(scope, stage, options)
public bind(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig
Parameters
- scope
Construct - stage
IStage - options
ActionBind Options
Returns
The callback invoked when this Action is added to a Pipeline.
onStateChange(name, target?, options?)
public onStateChange(name: string, target?: IRuleTarget, options?: RuleProps): Rule
Parameters
- name
string - target
IRuleTarget - options
RuleProps
Returns
Creates an Event that will be triggered whenever the state of this Action changes.
protected bound(scope, stage, options)
protected bound(scope: Construct, stage: IStage, options: ActionBindOptions): ActionConfig
Parameters
- scope
Construct - stage
IStage - options
ActionBind Options
Returns
This is a renamed version of the IAction.bind method.

.NET
Go
Java
Python
TypeScript (