Namespace Amazon.CDK.AWS.CodePipeline.Actions
AWS CodePipeline Actions
This package contains Actions that can be used in a CodePipeline.
using Amazon.CDK.AWS.CodePipeline;
using Amazon.CDK.AWS.CodePipeline.Actions;
Sources
AWS CodeCommit
To use a CodeCommit Repository in a CodePipeline:
var repo = new Repository(this, "Repo", new RepositoryProps {
RepositoryName = "MyRepo"
});
var pipeline = new Pipeline(this, "MyPipeline", new PipelineProps {
PipelineName = "MyPipeline"
});
var sourceOutput = new Artifact();
var sourceAction = new CodeCommitSourceAction(new CodeCommitSourceActionProps {
ActionName = "CodeCommit",
Repository = repo,
Output = sourceOutput
});
pipeline.AddStage(new StageOptions {
StageName = "Source",
Actions = new [] { sourceAction }
});
If you want to use existing role which can be used by on commit event rule. You can specify the role object in eventRole property.
Repository repo;
var eventRole = Role.FromRoleArn(this, "Event-role", "roleArn");
var sourceAction = new CodeCommitSourceAction(new CodeCommitSourceActionProps {
ActionName = "CodeCommit",
Repository = repo,
Output = new Artifact(),
EventRole = eventRole
});
If you want to clone the entire CodeCommit repository (only available for CodeBuild actions),
you can set the codeBuildCloneOutput
property to true
:
PipelineProject project;
Repository repo;
var sourceOutput = new Artifact();
var sourceAction = new CodeCommitSourceAction(new CodeCommitSourceActionProps {
ActionName = "CodeCommit",
Repository = repo,
Output = sourceOutput,
CodeBuildCloneOutput = true
});
var buildAction = new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CodeBuild",
Project = project,
Input = sourceOutput, // The build action must use the CodeCommitSourceAction output as input.
Outputs = new [] { new Artifact() }
});
The CodeCommit source action emits variables:
PipelineProject project;
Repository repo;
var sourceOutput = new Artifact();
var sourceAction = new CodeCommitSourceAction(new CodeCommitSourceActionProps {
ActionName = "CodeCommit",
Repository = repo,
Output = sourceOutput,
VariablesNamespace = "MyNamespace"
});
// later:
// later:
new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CodeBuild",
Project = project,
Input = sourceOutput,
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
{ "COMMIT_ID", new BuildEnvironmentVariable {
Value = sourceAction.Variables.CommitId
} }
}
});
If you want to use a custom event for your CodeCommitSourceAction
, you can pass in
a customEventRule
which needs an event pattern (see here) and an IRuleTarget
(see here)
Repository repo;
Function lambdaFuntion;
IDictionary<string, object> eventPattern = new Dictionary<string, object> {
{ "detail-type", new [] { "CodeCommit Repository State Change" } },
{ "resources", new [] { "foo" } },
{ "source", new [] { "aws.codecommit" } },
{ "detail", new Dictionary<string, string[]> {
{ "referenceType", new [] { "branch" } },
{ "event", new [] { "referenceCreated", "referenceUpdated" } },
{ "referenceName", new [] { "master" } }
} }
};
var sourceOutput = new Artifact();
var sourceAction = new CodeCommitSourceAction(new CodeCommitSourceActionProps {
ActionName = "CodeCommit",
Repository = repo,
Output = sourceOutput,
CustomEventRule = new Dictionary<string, object> {
{ "eventPattern", eventPattern },
{ "target", new LambdaFunction(lambdaFuntion) }
}
});
GitHub
If you want to use a GitHub repository as the source, you must create:
To use GitHub as the source of a CodePipeline:
// Read the secret from Secrets Manager
var pipeline = new Pipeline(this, "MyPipeline");
var sourceOutput = new Artifact();
var sourceAction = new GitHubSourceAction(new GitHubSourceActionProps {
ActionName = "GitHub_Source",
Owner = "awslabs",
Repo = "aws-cdk",
OauthToken = SecretValue.SecretsManager("my-github-token"),
Output = sourceOutput,
Branch = "develop"
});
pipeline.AddStage(new StageOptions {
StageName = "Source",
Actions = new [] { sourceAction }
});
The GitHub source action emits variables:
Artifact sourceOutput;
PipelineProject project;
var sourceAction = new GitHubSourceAction(new GitHubSourceActionProps {
ActionName = "Github_Source",
Output = sourceOutput,
Owner = "my-owner",
Repo = "my-repo",
OauthToken = SecretValue.SecretsManager("my-github-token"),
VariablesNamespace = "MyNamespace"
});
// later:
// later:
new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CodeBuild",
Project = project,
Input = sourceOutput,
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
{ "COMMIT_URL", new BuildEnvironmentVariable {
Value = sourceAction.Variables.CommitUrl
} }
}
});
BitBucket
CodePipeline can use a BitBucket Git repository as a source:
Note: you have to manually connect CodePipeline through the AWS Console with your BitBucket account.
This is a one-time operation for a given AWS account in a given region.
The simplest way to do that is to either start creating a new CodePipeline,
or edit an existing one, while being logged in to BitBucket.
Choose BitBucket as the source,
and grant CodePipeline permissions to your BitBucket account.
Copy & paste the Connection ARN that you get in the console,
or use the codestar-connections list-connections
AWS CLI operation
to find it.
After that, you can safely abort creating or editing the pipeline -
the connection has already been created.
var sourceOutput = new Artifact();
var sourceAction = new CodeStarConnectionsSourceAction(new CodeStarConnectionsSourceActionProps {
ActionName = "BitBucket_Source",
Owner = "aws",
Repo = "aws-cdk",
Output = sourceOutput,
ConnectionArn = "arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh"
});
You can also use the CodeStarConnectionsSourceAction
to connect to GitHub, in the same way
(you just have to select GitHub as the source when creating the connection in the console).
Similarly to GitHubSourceAction
, CodeStarConnectionsSourceAction
also emits the variables:
Project project;
var sourceOutput = new Artifact();
var sourceAction = new CodeStarConnectionsSourceAction(new CodeStarConnectionsSourceActionProps {
ActionName = "BitBucket_Source",
Owner = "aws",
Repo = "aws-cdk",
Output = sourceOutput,
ConnectionArn = "arn:aws:codestar-connections:us-east-1:123456789012:connection/12345678-abcd-12ab-34cdef5678gh",
VariablesNamespace = "SomeSpace"
});
// later:
// later:
new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CodeBuild",
Project = project,
Input = sourceOutput,
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
{ "COMMIT_ID", new BuildEnvironmentVariable {
Value = sourceAction.Variables.CommitId
} }
}
});
AWS S3 Source
To use an S3 Bucket as a source in CodePipeline:
var sourceBucket = new Bucket(this, "MyBucket", new BucketProps {
Versioned = true
});
var pipeline = new Pipeline(this, "MyPipeline");
var sourceOutput = new Artifact();
var sourceAction = new S3SourceAction(new S3SourceActionProps {
ActionName = "S3Source",
Bucket = sourceBucket,
BucketKey = "path/to/file.zip",
Output = sourceOutput
});
pipeline.AddStage(new StageOptions {
StageName = "Source",
Actions = new [] { sourceAction }
});
The region of the action will be determined by the region the bucket itself is in. When using a newly created bucket, that region will be taken from the stack the bucket belongs to; for an imported bucket, you can specify the region explicitly:
var sourceBucket = Bucket.FromBucketAttributes(this, "SourceBucket", new BucketAttributes {
BucketName = "my-bucket",
Region = "ap-southeast-1"
});
By default, the Pipeline will poll the Bucket to detect changes.
You can change that behavior to use CloudWatch Events by setting the trigger
property to S3Trigger.EVENTS
(it's S3Trigger.POLL
by default).
If you do that, make sure the source Bucket is part of an AWS CloudTrail Trail -
otherwise, the CloudWatch Events will not be emitted,
and your Pipeline will not react to changes in the Bucket.
You can do it through the CDK:
using Amazon.CDK.AWS.CloudTrail;
Bucket sourceBucket;
var sourceOutput = new Artifact();
var key = "some/key.zip";
var trail = new Trail(this, "CloudTrail");
trail.AddS3EventSelector(new [] { new S3EventSelector {
Bucket = sourceBucket,
ObjectPrefix = key
} }, new AddEventSelectorOptions {
ReadWriteType = ReadWriteType.WRITE_ONLY
});
var sourceAction = new S3SourceAction(new S3SourceActionProps {
ActionName = "S3Source",
BucketKey = key,
Bucket = sourceBucket,
Output = sourceOutput,
Trigger = S3Trigger.EVENTS
});
The S3 source action emits variables:
Bucket sourceBucket;
// later:
PipelineProject project;
var key = "some/key.zip";
var sourceOutput = new Artifact();
var sourceAction = new S3SourceAction(new S3SourceActionProps {
ActionName = "S3Source",
BucketKey = key,
Bucket = sourceBucket,
Output = sourceOutput,
VariablesNamespace = "MyNamespace"
});
new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CodeBuild",
Project = project,
Input = sourceOutput,
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
{ "VERSION_ID", new BuildEnvironmentVariable {
Value = sourceAction.Variables.VersionId
} }
}
});
AWS ECR
To use an ECR Repository as a source in a Pipeline:
using Amazon.CDK.AWS.ECR;
Repository ecrRepository;
var pipeline = new Pipeline(this, "MyPipeline");
var sourceOutput = new Artifact();
var sourceAction = new EcrSourceAction(new EcrSourceActionProps {
ActionName = "ECR",
Repository = ecrRepository,
ImageTag = "some-tag", // optional, default: 'latest'
Output = sourceOutput
});
pipeline.AddStage(new StageOptions {
StageName = "Source",
Actions = new [] { sourceAction }
});
The ECR source action emits variables:
using Amazon.CDK.AWS.ECR;
Repository ecrRepository;
// later:
PipelineProject project;
var sourceOutput = new Artifact();
var sourceAction = new EcrSourceAction(new EcrSourceActionProps {
ActionName = "Source",
Output = sourceOutput,
Repository = ecrRepository,
VariablesNamespace = "MyNamespace"
});
new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CodeBuild",
Project = project,
Input = sourceOutput,
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
{ "IMAGE_URI", new BuildEnvironmentVariable {
Value = sourceAction.Variables.ImageUri
} }
}
});
Build & test
AWS CodeBuild
Example of a CodeBuild Project used in a Pipeline, alongside CodeCommit:
PipelineProject project;
var repository = new Repository(this, "MyRepository", new RepositoryProps {
RepositoryName = "MyRepository"
});
var project = new PipelineProject(this, "MyProject");
var sourceOutput = new Artifact();
var sourceAction = new CodeCommitSourceAction(new CodeCommitSourceActionProps {
ActionName = "CodeCommit",
Repository = repository,
Output = sourceOutput
});
var buildAction = new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CodeBuild",
Project = project,
Input = sourceOutput,
Outputs = new [] { new Artifact() }, // optional
ExecuteBatchBuild = true, // optional, defaults to false
CombineBatchBuildArtifacts = true
});
new Pipeline(this, "MyPipeline", new PipelineProps {
Stages = new [] { new StageProps {
StageName = "Source",
Actions = new [] { sourceAction }
}, new StageProps {
StageName = "Build",
Actions = new [] { buildAction }
} }
});
The default category of the CodeBuild Action is Build
;
if you want a Test
Action instead,
override the type
property:
PipelineProject project;
var sourceOutput = new Artifact();
var testAction = new CodeBuildAction(new CodeBuildActionProps {
ActionName = "IntegrationTest",
Project = project,
Input = sourceOutput,
Type = CodeBuildActionType.TEST
});
Multiple inputs and outputs
When you want to have multiple inputs and/or outputs for a Project used in a
Pipeline, instead of using the secondarySources
and secondaryArtifacts
properties of the Project
class, you need to use the extraInputs
and
outputs
properties of the CodeBuild CodePipeline
Actions. Example:
Repository repository1;
Repository repository2;
PipelineProject project;
var sourceOutput1 = new Artifact();
var sourceAction1 = new CodeCommitSourceAction(new CodeCommitSourceActionProps {
ActionName = "Source1",
Repository = repository1,
Output = sourceOutput1
});
var sourceOutput2 = new Artifact("source2");
var sourceAction2 = new CodeCommitSourceAction(new CodeCommitSourceActionProps {
ActionName = "Source2",
Repository = repository2,
Output = sourceOutput2
});
var buildAction = new CodeBuildAction(new CodeBuildActionProps {
ActionName = "Build",
Project = project,
Input = sourceOutput1,
ExtraInputs = new [] { sourceOutput2 },
Outputs = new [] {
new Artifact("artifact1"), // for better buildspec readability - see below
new Artifact("artifact2") }
});
Note: when a CodeBuild Action in a Pipeline has more than one output, it
only uses the secondary-artifacts
field of the buildspec, never the
primary output specification directly under artifacts
. Because of that, it
pays to explicitly name all output artifacts of that Action, like we did
above, so that you know what name to use in the buildspec.
Example buildspec for the above project:
var project = new PipelineProject(this, "MyProject", new PipelineProjectProps {
BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" },
{ "phases", new Dictionary<string, IDictionary<string, object[]>> {
{ "build", new Struct {
Commands = new [] { }
} }
} },
{ "artifacts", new Dictionary<string, IDictionary<string, IDictionary<string, object>>> {
{ "secondary-artifacts", new Struct {
Artifact1 = new Struct { },
Artifact2 = new Struct { }
} }
} }
})
});
Variables
The CodeBuild action emits variables. Unlike many other actions, the variables are not static, but dynamic, defined in the buildspec, in the 'exported-variables' subsection of the 'env' section. Example:
// later:
PipelineProject project;
var sourceOutput = new Artifact();
var buildAction = new CodeBuildAction(new CodeBuildActionProps {
ActionName = "Build1",
Input = sourceOutput,
Project = new PipelineProject(this, "Project", new PipelineProjectProps {
BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" },
{ "env", new Dictionary<string, string[]> {
{ "exported-variables", new [] { "MY_VAR" } }
} },
{ "phases", new Dictionary<string, IDictionary<string, string>> {
{ "build", new Struct {
Commands = "export MY_VAR=\"some value\""
} }
} }
})
}),
VariablesNamespace = "MyNamespace"
});
new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CodeBuild",
Project = project,
Input = sourceOutput,
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
{ "MyVar", new BuildEnvironmentVariable {
Value = buildAction.Variable("MY_VAR")
} }
}
});
Jenkins
In order to use Jenkins Actions in the Pipeline,
you first need to create a JenkinsProvider
:
var jenkinsProvider = new JenkinsProvider(this, "JenkinsProvider", new JenkinsProviderProps {
ProviderName = "MyJenkinsProvider",
ServerUrl = "http://my-jenkins.com:8080",
Version = "2"
});
If you've registered a Jenkins provider in a different CDK app, or outside the CDK (in the CodePipeline AWS Console, for example), you can import it:
var jenkinsProvider = JenkinsProvider.FromJenkinsProviderAttributes(this, "JenkinsProvider", new JenkinsProviderAttributes {
ProviderName = "MyJenkinsProvider",
ServerUrl = "http://my-jenkins.com:8080",
Version = "2"
});
Note that a Jenkins provider (identified by the provider name-category(build/test)-version tuple) must always be registered in the given account, in the given AWS region, before it can be used in CodePipeline.
With a JenkinsProvider
,
we can create a Jenkins Action:
JenkinsProvider jenkinsProvider;
var buildAction = new JenkinsAction(new JenkinsActionProps {
ActionName = "JenkinsBuild",
JenkinsProvider = jenkinsProvider,
ProjectName = "MyProject",
Type = JenkinsActionType.BUILD
});
Deploy
AWS CloudFormation
This module contains Actions that allows you to deploy to CloudFormation from AWS CodePipeline.
For example, the following code fragment defines a pipeline that automatically deploys a CloudFormation template directly from a CodeCommit repository, with a manual approval step in between to confirm the changes:
// Source stage: read from repository
var repo = new Repository(stack, "TemplateRepo", new RepositoryProps {
RepositoryName = "template-repo"
});
var sourceOutput = new Artifact("SourceArtifact");
var source = new CodeCommitSourceAction(new CodeCommitSourceActionProps {
ActionName = "Source",
Repository = repo,
Output = sourceOutput,
Trigger = CodeCommitTrigger.POLL
});
IDictionary<string, object> sourceStage = new Dictionary<string, object> {
{ "stageName", "Source" },
{ "actions", new [] { source } }
};
// Deployment stage: create and deploy changeset with manual approval
var stackName = "OurStack";
var changeSetName = "StagedChangeSet";
IDictionary<string, object> prodStage = new Dictionary<string, object> {
{ "stageName", "Deploy" },
{ "actions", new [] {
new CloudFormationCreateReplaceChangeSetAction(new CloudFormationCreateReplaceChangeSetActionProps {
ActionName = "PrepareChanges",
StackName = stackName,
ChangeSetName = changeSetName,
AdminPermissions = true,
TemplatePath = sourceOutput.AtPath("template.yaml"),
RunOrder = 1
}),
new ManualApprovalAction(new ManualApprovalActionProps {
ActionName = "ApproveChanges",
RunOrder = 2
}),
new CloudFormationExecuteChangeSetAction(new CloudFormationExecuteChangeSetActionProps {
ActionName = "ExecuteChanges",
StackName = stackName,
ChangeSetName = changeSetName,
RunOrder = 3
}) } }
};
new Pipeline(stack, "Pipeline", new PipelineProps {
CrossAccountKeys = true,
Stages = new [] { sourceStage, prodStage }
});
See the AWS documentation for more details about using CloudFormation in CodePipeline.
Actions for updating individual CloudFormation Stacks
This package contains the following CloudFormation actions:
Actions for deploying CloudFormation StackSets to multiple accounts
You can use CloudFormation StackSets to deploy the same CloudFormation template to multiple accounts in a managed way. If you use AWS Organizations, StackSets can be deployed to all accounts in a particular Organizational Unit (OU), and even automatically to new accounts as soon as they are added to a particular OU. For more information, see the Working with StackSets section of the CloudFormation developer guide.
The actions available for updating StackSets are:
Here's an example of using both of these actions:
Pipeline pipeline;
Artifact sourceOutput;
pipeline.AddStage(new StageOptions {
StageName = "DeployStackSets",
Actions = new [] {
// First, update the StackSet itself with the newest template
new CloudFormationDeployStackSetAction(new CloudFormationDeployStackSetActionProps {
ActionName = "UpdateStackSet",
RunOrder = 1,
StackSetName = "MyStackSet",
Template = StackSetTemplate.FromArtifactPath(sourceOutput.AtPath("template.yaml")),
// Change this to 'StackSetDeploymentModel.organizations()' if you want to deploy to OUs
DeploymentModel = StackSetDeploymentModel.SelfManaged(),
// This deploys to a set of accounts
StackInstances = StackInstances.InAccounts(new [] { "111111111111" }, new [] { "us-east-1", "eu-west-1" })
}),
// Afterwards, update/create additional instances in other accounts
new CloudFormationDeployStackInstancesAction(new CloudFormationDeployStackInstancesActionProps {
ActionName = "AddMoreInstances",
RunOrder = 2,
StackSetName = "MyStackSet",
StackInstances = StackInstances.InAccounts(new [] { "222222222222", "333333333333" }, new [] { "us-east-1", "eu-west-1" })
}) }
});
Lambda deployed through CodePipeline
If you want to deploy your Lambda through CodePipeline,
and you don't use assets (for example, because your CDK code and Lambda code are separate),
you can use a special Lambda Code
class, CfnParametersCode
.
Note that your Lambda must be in a different Stack than your Pipeline.
The Lambda itself will be deployed, alongside the entire Stack it belongs to,
using a CloudFormation CodePipeline Action. Example:
var lambdaStack = new Stack(app, "LambdaStack");
var lambdaCode = Code.FromCfnParameters();
new Function(lambdaStack, "Lambda", new FunctionProps {
Code = lambdaCode,
Handler = "index.handler",
Runtime = Runtime.NODEJS_LATEST
});
// other resources that your Lambda needs, added to the lambdaStack...
var pipelineStack = new Stack(app, "PipelineStack");
var pipeline = new Pipeline(pipelineStack, "Pipeline", new PipelineProps {
CrossAccountKeys = true
});
// add the source code repository containing this code to your Pipeline,
// and the source code of the Lambda Function, if they're separate
var cdkSourceOutput = new Artifact();
var cdkSourceAction = new CodeCommitSourceAction(new CodeCommitSourceActionProps {
Repository = new Repository(pipelineStack, "CdkCodeRepo", new RepositoryProps {
RepositoryName = "CdkCodeRepo"
}),
ActionName = "CdkCode_Source",
Output = cdkSourceOutput
});
var lambdaSourceOutput = new Artifact();
var lambdaSourceAction = new CodeCommitSourceAction(new CodeCommitSourceActionProps {
Repository = new Repository(pipelineStack, "LambdaCodeRepo", new RepositoryProps {
RepositoryName = "LambdaCodeRepo"
}),
ActionName = "LambdaCode_Source",
Output = lambdaSourceOutput
});
pipeline.AddStage(new StageOptions {
StageName = "Source",
Actions = new [] { cdkSourceAction, lambdaSourceAction }
});
// synthesize the Lambda CDK template, using CodeBuild
// the below values are just examples, assuming your CDK code is in TypeScript/JavaScript -
// adjust the build environment and/or commands accordingly
var cdkBuildProject = new Project(pipelineStack, "CdkBuildProject", new ProjectProps {
Environment = new BuildEnvironment {
BuildImage = LinuxBuildImage.STANDARD_7_0
},
BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" },
{ "phases", new Dictionary<string, IDictionary<string, string>> {
{ "install", new Struct {
Commands = "npm install"
} },
{ "build", new Struct {
Commands = new [] { "npm run build", "npm run cdk synth LambdaStack -- -o ." }
} }
} },
{ "artifacts", new Dictionary<string, string> {
{ "files", "LambdaStack.template.yaml" }
} }
})
});
var cdkBuildOutput = new Artifact();
var cdkBuildAction = new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CDK_Build",
Project = cdkBuildProject,
Input = cdkSourceOutput,
Outputs = new [] { cdkBuildOutput }
});
// build your Lambda code, using CodeBuild
// again, this example assumes your Lambda is written in TypeScript/JavaScript -
// make sure to adjust the build environment and/or commands if they don't match your specific situation
var lambdaBuildProject = new Project(pipelineStack, "LambdaBuildProject", new ProjectProps {
Environment = new BuildEnvironment {
BuildImage = LinuxBuildImage.STANDARD_7_0
},
BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" },
{ "phases", new Dictionary<string, IDictionary<string, string>> {
{ "install", new Struct {
Commands = "npm install"
} },
{ "build", new Struct {
Commands = "npm run build"
} }
} },
{ "artifacts", new Dictionary<string, string[]> {
{ "files", new [] { "index.js", "node_modules/**/*" } }
} }
})
});
var lambdaBuildOutput = new Artifact();
var lambdaBuildAction = new CodeBuildAction(new CodeBuildActionProps {
ActionName = "Lambda_Build",
Project = lambdaBuildProject,
Input = lambdaSourceOutput,
Outputs = new [] { lambdaBuildOutput }
});
pipeline.AddStage(new StageOptions {
StageName = "Build",
Actions = new [] { cdkBuildAction, lambdaBuildAction }
});
// finally, deploy your Lambda Stack
pipeline.AddStage(new StageOptions {
StageName = "Deploy",
Actions = new [] {
new CloudFormationCreateUpdateStackAction(new CloudFormationCreateUpdateStackActionProps {
ActionName = "Lambda_CFN_Deploy",
TemplatePath = cdkBuildOutput.AtPath("LambdaStack.template.yaml"),
StackName = "LambdaStackDeployedName",
AdminPermissions = true,
ParameterOverrides = lambdaCode.Assign(lambdaBuildOutput.S3Location),
ExtraInputs = new [] { lambdaBuildOutput }
}) }
});
Cross-account actions
If you want to update stacks in a different account,
pass the account
property when creating the action:
var sourceOutput = new Artifact();
new CloudFormationCreateUpdateStackAction(new CloudFormationCreateUpdateStackActionProps {
ActionName = "CloudFormationCreateUpdate",
StackName = "MyStackName",
AdminPermissions = true,
TemplatePath = sourceOutput.AtPath("template.yaml"),
Account = "123456789012"
});
This will create a new stack, called <PipelineStackName>-support-123456789012
, in your App
,
that will contain the role that the pipeline will assume in account 123456789012 before executing this action.
This support stack will automatically be deployed before the stack containing the pipeline.
You can also pass a role explicitly when creating the action -
in that case, the account
property is ignored,
and the action will operate in the same account the role belongs to:
using Amazon.CDK;
// in stack for account 123456789012...
Stack otherAccountStack;
var actionRole = new Role(otherAccountStack, "ActionRole", new RoleProps {
AssumedBy = new AccountPrincipal("123456789012"),
// the role has to have a physical name set
RoleName = PhysicalName.GENERATE_IF_NEEDED
});
// in the pipeline stack...
var sourceOutput = new Artifact();
new CloudFormationCreateUpdateStackAction(new CloudFormationCreateUpdateStackActionProps {
ActionName = "CloudFormationCreateUpdate",
StackName = "MyStackName",
AdminPermissions = true,
TemplatePath = sourceOutput.AtPath("template.yaml"),
Role = actionRole
});
AWS CodeDeploy
Server deployments
To use CodeDeploy for EC2/on-premise deployments in a Pipeline:
ServerDeploymentGroup deploymentGroup;
var pipeline = new Pipeline(this, "MyPipeline", new PipelineProps {
PipelineName = "MyPipeline"
});
// add the source and build Stages to the Pipeline...
var buildOutput = new Artifact();
var deployAction = new CodeDeployServerDeployAction(new CodeDeployServerDeployActionProps {
ActionName = "CodeDeploy",
Input = buildOutput,
DeploymentGroup = deploymentGroup
});
pipeline.AddStage(new StageOptions {
StageName = "Deploy",
Actions = new [] { deployAction }
});
Lambda deployments
To use CodeDeploy for blue-green Lambda deployments in a Pipeline:
var lambdaCode = Code.FromCfnParameters();
var func = new Function(this, "Lambda", new FunctionProps {
Code = lambdaCode,
Handler = "index.handler",
Runtime = Runtime.NODEJS_LATEST
});
// used to make sure each CDK synthesis produces a different Version
var version = func.CurrentVersion;
var alias = new Alias(this, "LambdaAlias", new AliasProps {
AliasName = "Prod",
Version = version
});
new LambdaDeploymentGroup(this, "DeploymentGroup", new LambdaDeploymentGroupProps {
Alias = alias,
DeploymentConfig = LambdaDeploymentConfig.LINEAR_10PERCENT_EVERY_1MINUTE
});
Then, you need to create your Pipeline Stack,
where you will define your Pipeline,
and deploy the lambdaStack
using a CloudFormation CodePipeline Action
(see above for a complete example).
ECS
CodePipeline can deploy an ECS service. The deploy Action receives one input Artifact which contains the image definition file:
using Amazon.CDK.AWS.ECS;
FargateService service;
var pipeline = new Pipeline(this, "MyPipeline");
var buildOutput = new Artifact();
var deployStage = pipeline.AddStage(new StageOptions {
StageName = "Deploy",
Actions = new [] {
new EcsDeployAction(new EcsDeployActionProps {
ActionName = "DeployAction",
Service = service,
// if your file is called imagedefinitions.json,
// use the `input` property,
// and leave out the `imageFile` property
Input = buildOutput,
// if your file name is _not_ imagedefinitions.json,
// use the `imageFile` property,
// and leave out the `input` property
ImageFile = buildOutput.AtPath("imageDef.json"),
DeploymentTimeout = Duration.Minutes(60)
}) }
});
Deploying ECS applications to existing services
CodePipeline can deploy to an existing ECS service which uses the ECS service ARN format that contains the Cluster name. This also works if the service is in a different account and/or region than the pipeline:
using Amazon.CDK.AWS.ECS;
var service = BaseService.FromServiceArnWithCluster(this, "EcsService", "arn:aws:ecs:us-east-1:123456789012:service/myClusterName/myServiceName");
var pipeline = new Pipeline(this, "MyPipeline");
var buildOutput = new Artifact();
// add source and build stages to the pipeline as usual...
var deployStage = pipeline.AddStage(new StageOptions {
StageName = "Deploy",
Actions = new [] {
new EcsDeployAction(new EcsDeployActionProps {
ActionName = "DeployAction",
Service = service,
Input = buildOutput
}) }
});
When deploying across accounts, especially in a CDK Pipelines self-mutating pipeline,
it is recommended to provide the role
property to the EcsDeployAction
.
The Role will need to have permissions assigned to it for ECS deployment.
See the CodePipeline documentation
for the permissions needed.
Deploying ECS applications stored in a separate source code repository
The idiomatic CDK way of deploying an ECS application is to have your Dockerfiles and your CDK code in the same source code repository, leveraging Docker Assets, and use the CDK Pipelines module.
However, if you want to deploy a Docker application whose source code is kept in a separate version control repository than the CDK code,
you can use the TagParameterContainerImage
class from the ECS module.
Here's an example:
/**
* These are the construction properties for `EcsAppStack`.
* They extend the standard Stack properties,
* but also require providing the ContainerImage that the service will use.
* That Image will be provided from the Stack containing the CodePipeline.
*/
class EcsAppStackProps : StackProps
{
public ContainerImage Image { get; set; }
}
/**
* This is the Stack containing a simple ECS Service that uses the provided ContainerImage.
*/
class EcsAppStack : Stack
{
public EcsAppStack(Construct scope, string id, EcsAppStackProps props) : base(scope, id, props)
{
var taskDefinition = new TaskDefinition(this, "TaskDefinition", new TaskDefinitionProps {
Compatibility = Compatibility.FARGATE,
Cpu = "1024",
MemoryMiB = "2048"
});
taskDefinition.AddContainer("AppContainer", new ContainerDefinitionOptions {
Image = props.Image
});
new FargateService(this, "EcsService", new FargateServiceProps {
TaskDefinition = taskDefinition,
Cluster = new Cluster(this, "Cluster", new ClusterProps {
Vpc = new Vpc(this, "Vpc", new VpcProps {
MaxAzs = 1
})
})
});
}
}
/**
* This is the Stack containing the CodePipeline definition that deploys an ECS Service.
*/
class PipelineStack : Stack
{
public TagParameterContainerImage TagParameterContainerImage { get; }
public PipelineStack(Construct scope, string id, StackProps? props=null) : base(scope, id, props)
{
/* ********** ECS part **************** */
// this is the ECR repository where the built Docker image will be pushed
var appEcrRepo = new Repository(this, "EcsDeployRepository");
// the build that creates the Docker image, and pushes it to the ECR repo
var appCodeDockerBuild = new PipelineProject(this, "AppCodeDockerImageBuildAndPushProject", new PipelineProjectProps {
Environment = new BuildEnvironment {
// we need to run Docker
Privileged = true
},
BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" },
{ "phases", new Dictionary<string, IDictionary<string, string[]>> {
{ "build", new Struct {
Commands = new [] { "$(aws ecr get-login --region $AWS_DEFAULT_REGION --no-include-email)", "docker build -t $REPOSITORY_URI:$CODEBUILD_RESOLVED_SOURCE_VERSION ." }
} },
{ "post_build", new Struct {
Commands = new [] { "docker push $REPOSITORY_URI:$CODEBUILD_RESOLVED_SOURCE_VERSION", "export imageTag=$CODEBUILD_RESOLVED_SOURCE_VERSION" }
} }
} },
{ "env", new Dictionary<string, string[]> {
// save the imageTag environment variable as a CodePipeline Variable
{ "exported-variables", new [] { "imageTag" } }
} }
}),
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
{ "REPOSITORY_URI", new BuildEnvironmentVariable {
Value = appEcrRepo.RepositoryUri
} }
}
});
// needed for `docker push`
appEcrRepo.GrantPullPush(appCodeDockerBuild);
// create the ContainerImage used for the ECS application Stack
TagParameterContainerImage = new TagParameterContainerImage(appEcrRepo);
var cdkCodeBuild = new PipelineProject(this, "CdkCodeBuildProject", new PipelineProjectProps {
BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" },
{ "phases", new Dictionary<string, IDictionary<string, string[]>> {
{ "install", new Struct {
Commands = new [] { "npm install" }
} },
{ "build", new Struct {
Commands = new [] { "npx cdk synth --verbose" }
} }
} },
{ "artifacts", new Dictionary<string, string> {
// store the entire Cloud Assembly as the output artifact
{ "base-directory", "cdk.out" },
{ "files", "**/*" }
} }
})
});
/* ********** Pipeline part **************** */
var appCodeSourceOutput = new Artifact();
var cdkCodeSourceOutput = new Artifact();
var cdkCodeBuildOutput = new Artifact();
var appCodeBuildAction = new CodeBuildAction(new CodeBuildActionProps {
ActionName = "AppCodeDockerImageBuildAndPush",
Project = appCodeDockerBuild,
Input = appCodeSourceOutput
});
new Pipeline(this, "CodePipelineDeployingEcsApplication", new PipelineProps {
ArtifactBucket = new Bucket(this, "ArtifactBucket", new BucketProps {
RemovalPolicy = RemovalPolicy.DESTROY
}),
Stages = new [] { new StageProps {
StageName = "Source",
Actions = new [] {
// this is the Action that takes the source of your application code
new CodeCommitSourceAction(new CodeCommitSourceActionProps {
ActionName = "AppCodeSource",
Repository = new Repository(this, "AppCodeSourceRepository", new RepositoryProps { RepositoryName = "AppCodeSourceRepository" }),
Output = appCodeSourceOutput
}),
// this is the Action that takes the source of your CDK code
// (which would probably include this Pipeline code as well)
new CodeCommitSourceAction(new CodeCommitSourceActionProps {
ActionName = "CdkCodeSource",
Repository = new Repository(this, "CdkCodeSourceRepository", new RepositoryProps { RepositoryName = "CdkCodeSourceRepository" }),
Output = cdkCodeSourceOutput
}) }
}, new StageProps {
StageName = "Build",
Actions = new [] { appCodeBuildAction,
new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CdkCodeBuildAndSynth",
Project = cdkCodeBuild,
Input = cdkCodeSourceOutput,
Outputs = new [] { cdkCodeBuildOutput }
}) }
}, new StageProps {
StageName = "Deploy",
Actions = new [] {
new CloudFormationCreateUpdateStackAction(new CloudFormationCreateUpdateStackActionProps {
ActionName = "CFN_Deploy",
StackName = "SampleEcsStackDeployedFromCodePipeline",
// this name has to be the same name as used below in the CDK code for the application Stack
TemplatePath = cdkCodeBuildOutput.AtPath("EcsStackDeployedInPipeline.template.json"),
AdminPermissions = true,
ParameterOverrides = new Dictionary<string, object> {
// read the tag pushed to the ECR repository from the CodePipeline Variable saved by the application build step,
// and pass it as the CloudFormation Parameter for the tag
{ TagParameterContainerImage.TagParameterName, appCodeBuildAction.Variable("imageTag") }
}
}) }
} }
});
}
}
var app = new App();
// the CodePipeline Stack needs to be created first
var pipelineStack = new PipelineStack(app, "aws-cdk-pipeline-ecs-separate-sources");
// we supply the image to the ECS application Stack from the CodePipeline Stack
// we supply the image to the ECS application Stack from the CodePipeline Stack
new EcsAppStack(app, "EcsStackDeployedInPipeline", new EcsAppStackProps {
Image = pipelineStack.TagParameterContainerImage
});
AWS S3 Deployment
To use an S3 Bucket as a deployment target in CodePipeline:
using Amazon.CDK.AWS.KMS;
var sourceOutput = new Artifact();
var targetBucket = new Bucket(this, "MyBucket");
var key = new Key(this, "EnvVarEncryptKey", new KeyProps {
Description = "sample key"
});
var pipeline = new Pipeline(this, "MyPipeline");
var deployAction = new S3DeployAction(new S3DeployActionProps {
ActionName = "S3Deploy",
Bucket = targetBucket,
Input = sourceOutput,
EncryptionKey = key
});
var deployStage = pipeline.AddStage(new StageOptions {
StageName = "Deploy",
Actions = new [] { deployAction }
});
Invalidating the CloudFront cache when deploying to S3
There is currently no native support in CodePipeline for invalidating a CloudFront cache after deployment. One workaround is to add another build step after the deploy step, and use the AWS CLI to invalidate the cache:
// Create a Cloudfront Web Distribution
using Amazon.CDK.AWS.CloudFront;
Distribution distribution;
// Create the build project that will invalidate the cache
var invalidateBuildProject = new PipelineProject(this, "InvalidateProject", new PipelineProjectProps {
BuildSpec = BuildSpec.FromObject(new Dictionary<string, object> {
{ "version", "0.2" },
{ "phases", new Dictionary<string, IDictionary<string, string[]>> {
{ "build", new Struct {
Commands = new [] { "aws cloudfront create-invalidation --distribution-id ${CLOUDFRONT_ID} --paths \"/*\"" }
} }
} }
}),
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
{ "CLOUDFRONT_ID", new BuildEnvironmentVariable { Value = distribution.DistributionId } }
}
});
// Add Cloudfront invalidation permissions to the project
var distributionArn = $"arn:aws:cloudfront::{this.account}:distribution/{distribution.distributionId}";
invalidateBuildProject.AddToRolePolicy(new PolicyStatement(new PolicyStatementProps {
Resources = new [] { distributionArn },
Actions = new [] { "cloudfront:CreateInvalidation" }
}));
// Create the pipeline (here only the S3 deploy and Invalidate cache build)
var deployBucket = new Bucket(this, "DeployBucket");
var deployInput = new Artifact();
new Pipeline(this, "Pipeline", new PipelineProps {
Stages = new [] { new StageProps {
StageName = "Deploy",
Actions = new [] {
new S3DeployAction(new S3DeployActionProps {
ActionName = "S3Deploy",
Bucket = deployBucket,
Input = deployInput,
RunOrder = 1
}),
new CodeBuildAction(new CodeBuildActionProps {
ActionName = "InvalidateCache",
Project = invalidateBuildProject,
Input = deployInput,
RunOrder = 2
}) }
} }
});
Elastic Beanstalk Deployment
To deploy an Elastic Beanstalk Application in CodePipeline:
var sourceOutput = new Artifact();
var targetBucket = new Bucket(this, "MyBucket");
var pipeline = new Pipeline(this, "MyPipeline");
var deployAction = new ElasticBeanstalkDeployAction(new ElasticBeanstalkDeployActionProps {
ActionName = "ElasticBeanstalkDeploy",
Input = sourceOutput,
EnvironmentName = "envName",
ApplicationName = "appName"
});
var deployStage = pipeline.AddStage(new StageOptions {
StageName = "Deploy",
Actions = new [] { deployAction }
});
Alexa Skill
You can deploy to Alexa using CodePipeline with the following Action:
// Read the secrets from ParameterStore
var clientId = SecretValue.SecretsManager("AlexaClientId");
var clientSecret = SecretValue.SecretsManager("AlexaClientSecret");
var refreshToken = SecretValue.SecretsManager("AlexaRefreshToken");
// Add deploy action
var sourceOutput = new Artifact();
new AlexaSkillDeployAction(new AlexaSkillDeployActionProps {
ActionName = "DeploySkill",
RunOrder = 1,
Input = sourceOutput,
ClientId = clientId.ToString(),
ClientSecret = clientSecret,
RefreshToken = refreshToken,
SkillId = "amzn1.ask.skill.12345678-1234-1234-1234-123456789012"
});
If you need manifest overrides you can specify them as parameterOverridesArtifact
in the action:
// Deploy some CFN change set and store output
var executeOutput = new Artifact("CloudFormation");
var executeChangeSetAction = new CloudFormationExecuteChangeSetAction(new CloudFormationExecuteChangeSetActionProps {
ActionName = "ExecuteChangesTest",
RunOrder = 2,
StackName = "MyStack",
ChangeSetName = "MyChangeSet",
OutputFileName = "overrides.json",
Output = executeOutput
});
// Provide CFN output as manifest overrides
var clientId = SecretValue.SecretsManager("AlexaClientId");
var clientSecret = SecretValue.SecretsManager("AlexaClientSecret");
var refreshToken = SecretValue.SecretsManager("AlexaRefreshToken");
var sourceOutput = new Artifact();
new AlexaSkillDeployAction(new AlexaSkillDeployActionProps {
ActionName = "DeploySkill",
RunOrder = 1,
Input = sourceOutput,
ParameterOverridesArtifact = executeOutput,
ClientId = clientId.ToString(),
ClientSecret = clientSecret,
RefreshToken = refreshToken,
SkillId = "amzn1.ask.skill.12345678-1234-1234-1234-123456789012"
});
AWS Service Catalog
You can deploy a CloudFormation template to an existing Service Catalog product with the following Action:
var cdkBuildOutput = new Artifact();
var serviceCatalogDeployAction = new ServiceCatalogDeployActionBeta1(new ServiceCatalogDeployActionBeta1Props {
ActionName = "ServiceCatalogDeploy",
TemplatePath = cdkBuildOutput.AtPath("Sample.template.json"),
ProductVersionName = "Version - " + Date.Now.ToString,
ProductVersionDescription = "This is a version from the pipeline with a new description.",
ProductId = "prod-XXXXXXXX"
});
Approve & invoke
Manual approval Action
This package contains an Action that stops the Pipeline until someone manually clicks the approve button:
using Amazon.CDK.AWS.SNS;
var pipeline = new Pipeline(this, "MyPipeline");
var approveStage = pipeline.AddStage(new StageOptions { StageName = "Approve" });
var manualApprovalAction = new ManualApprovalAction(new ManualApprovalActionProps {
ActionName = "Approve",
NotificationTopic = new Topic(this, "Topic"), // optional
NotifyEmails = new [] { "some_email@example.com" }, // optional
AdditionalInformation = "additional info"
});
approveStage.AddAction(manualApprovalAction);
If the notificationTopic
has not been provided,
but notifyEmails
were,
a new SNS Topic will be created
(and accessible through the notificationTopic
property of the Action).
If you want to grant a principal permissions to approve the changes,
you can invoke the method grantManualApproval
passing it a IGrantable
:
var pipeline = new Pipeline(this, "MyPipeline");
var approveStage = pipeline.AddStage(new StageOptions { StageName = "Approve" });
var manualApprovalAction = new ManualApprovalAction(new ManualApprovalActionProps {
ActionName = "Approve"
});
approveStage.AddAction(manualApprovalAction);
var role = Role.FromRoleArn(this, "Admin", Arn.Format(new ArnComponents { Service = "iam", Resource = "role", ResourceName = "Admin" }, this));
manualApprovalAction.GrantManualApproval(role);
AWS Lambda
This module contains an Action that allows you to invoke a Lambda function in a Pipeline:
Function fn;
var pipeline = new Pipeline(this, "MyPipeline");
var lambdaAction = new LambdaInvokeAction(new LambdaInvokeActionProps {
ActionName = "Lambda",
Lambda = fn
});
pipeline.AddStage(new StageOptions {
StageName = "Lambda",
Actions = new [] { lambdaAction }
});
The Lambda Action can have up to 5 inputs, and up to 5 outputs:
Function fn;
var sourceOutput = new Artifact();
var buildOutput = new Artifact();
var lambdaAction = new LambdaInvokeAction(new LambdaInvokeActionProps {
ActionName = "Lambda",
Inputs = new [] { sourceOutput, buildOutput },
Outputs = new [] {
new Artifact("Out1"),
new Artifact("Out2") },
Lambda = fn
});
The Lambda Action supports custom user parameters that pipeline will pass to the Lambda function:
Function fn;
var pipeline = new Pipeline(this, "MyPipeline");
var lambdaAction = new LambdaInvokeAction(new LambdaInvokeActionProps {
ActionName = "Lambda",
Lambda = fn,
UserParameters = new Dictionary<string, object> {
{ "foo", "bar" },
{ "baz", "qux" }
},
// OR
UserParametersString = "my-parameter-string"
});
The Lambda invoke action emits variables.
Unlike many other actions, the variables are not static,
but dynamic, defined by the function calling the PutJobSuccessResult
API with the outputVariables
property filled with the map of variables
Example:
// later:
PipelineProject project;
var lambdaInvokeAction = new LambdaInvokeAction(new LambdaInvokeActionProps {
ActionName = "Lambda",
Lambda = new Function(this, "Func", new FunctionProps {
Runtime = Runtime.NODEJS_LATEST,
Handler = "index.handler",
Code = Code.FromInline(@"
const { CodePipeline } = require('@aws-sdk/client-codepipeline');
exports.handler = async function(event, context) {
const codepipeline = new AWS.CodePipeline();
await codepipeline.putJobSuccessResult({
jobId: event['CodePipeline.job'].id,
outputVariables: {
MY_VAR: ""some value"",
},
});
}
")
}),
VariablesNamespace = "MyNamespace"
});
var sourceOutput = new Artifact();
new CodeBuildAction(new CodeBuildActionProps {
ActionName = "CodeBuild",
Project = project,
Input = sourceOutput,
EnvironmentVariables = new Dictionary<string, BuildEnvironmentVariable> {
{ "MyVar", new BuildEnvironmentVariable {
Value = lambdaInvokeAction.Variable("MY_VAR")
} }
}
});
See the AWS documentation on how to write a Lambda function invoked from CodePipeline.
AWS Step Functions
This module contains an Action that allows you to invoke a Step Function in a Pipeline:
using Amazon.CDK.AWS.StepFunctions;
var pipeline = new Pipeline(this, "MyPipeline");
var startState = new Pass(this, "StartState");
var simpleStateMachine = new StateMachine(this, "SimpleStateMachine", new StateMachineProps {
Definition = startState
});
var stepFunctionAction = new StepFunctionInvokeAction(new StepFunctionsInvokeActionProps {
ActionName = "Invoke",
StateMachine = simpleStateMachine,
StateMachineInput = StateMachineInput.Literal(new Dictionary<string, boolean> { { "IsHelloWorldExample", true } })
});
pipeline.AddStage(new StageOptions {
StageName = "StepFunctions",
Actions = new [] { stepFunctionAction }
});
The StateMachineInput
can be created with one of 2 static factory methods:
literal
, which takes an arbitrary map as its only argument, or filePath
:
using Amazon.CDK.AWS.StepFunctions;
var pipeline = new Pipeline(this, "MyPipeline");
var inputArtifact = new Artifact();
var startState = new Pass(this, "StartState");
var simpleStateMachine = new StateMachine(this, "SimpleStateMachine", new StateMachineProps {
Definition = startState
});
var stepFunctionAction = new StepFunctionInvokeAction(new StepFunctionsInvokeActionProps {
ActionName = "Invoke",
StateMachine = simpleStateMachine,
StateMachineInput = StateMachineInput.FilePath(inputArtifact.AtPath("assets/input.json"))
});
pipeline.AddStage(new StageOptions {
StageName = "StepFunctions",
Actions = new [] { stepFunctionAction }
});
See the AWS documentation for information on Action structure reference.
Classes
Action | Low-level class for generic CodePipeline Actions. |
AlexaSkillDeployAction | Deploys the skill to Alexa. |
AlexaSkillDeployActionProps | Construction properties of the |
BaseJenkinsProvider | |
CacheControl | Used for HTTP cache-control header, which influences downstream caches. |
CloudFormationCreateReplaceChangeSetAction | CodePipeline action to prepare a change set. |
CloudFormationCreateReplaceChangeSetActionProps | Properties for the CloudFormationCreateReplaceChangeSetAction. |
CloudFormationCreateUpdateStackAction | CodePipeline action to deploy a stack. |
CloudFormationCreateUpdateStackActionProps | Properties for the CloudFormationCreateUpdateStackAction. |
CloudFormationDeleteStackAction | CodePipeline action to delete a stack. |
CloudFormationDeleteStackActionProps | Properties for the CloudFormationDeleteStackAction. |
CloudFormationDeployStackInstancesAction | CodePipeline action to create/update Stack Instances of a StackSet. |
CloudFormationDeployStackInstancesActionProps | Properties for the CloudFormationDeployStackInstancesAction. |
CloudFormationDeployStackSetAction | CodePipeline action to deploy a stackset. |
CloudFormationDeployStackSetActionProps | Properties for the CloudFormationDeployStackSetAction. |
CloudFormationExecuteChangeSetAction | CodePipeline action to execute a prepared change set. |
CloudFormationExecuteChangeSetActionProps | Properties for the CloudFormationExecuteChangeSetAction. |
CodeBuildAction | CodePipeline build action that uses AWS CodeBuild. |
CodeBuildActionProps | Construction properties of the |
CodeBuildActionType | The type of the CodeBuild action that determines its CodePipeline Category - Build, or Test. |
CodeCommitSourceAction | CodePipeline Source that is provided by an AWS CodeCommit repository. |
CodeCommitSourceActionProps | Construction properties of the |
CodeCommitSourceVariables | The CodePipeline variables emitted by the CodeCommit source Action. |
CodeCommitTrigger | How should the CodeCommit Action detect changes. |
CodeDeployEcsContainerImageInput | Configuration for replacing a placeholder string in the ECS task definition template file with an image URI. |
CodeDeployEcsDeployAction | |
CodeDeployEcsDeployActionProps | Construction properties of the |
CodeDeployServerDeployAction | |
CodeDeployServerDeployActionProps | Construction properties of the |
CodeStarConnectionsSourceAction | A CodePipeline source action for the CodeStar Connections source, which allows connecting to GitHub and BitBucket. |
CodeStarConnectionsSourceActionProps | Construction properties for |
CodeStarSourceVariables | The CodePipeline variables emitted by CodeStar source Action. |
CommonCloudFormationStackSetOptions | Options in common between both StackSet actions. |
EcrSourceAction | The ECR Repository source CodePipeline Action. |
EcrSourceActionProps | Construction properties of |
EcrSourceVariables | The CodePipeline variables emitted by the ECR source Action. |
EcsDeployAction | CodePipeline Action to deploy an ECS Service. |
EcsDeployActionProps | Construction properties of |
ElasticBeanstalkDeployAction | CodePipeline action to deploy an AWS ElasticBeanstalk Application. |
ElasticBeanstalkDeployActionProps | Construction properties of the |
GitHubSourceAction | Source that is provided by a GitHub repository. |
GitHubSourceActionProps | Construction properties of the |
GitHubSourceVariables | The CodePipeline variables emitted by GitHub source Action. |
GitHubTrigger | If and how the GitHub source action should be triggered. |
JenkinsAction | Jenkins build CodePipeline Action. |
JenkinsActionProps | Construction properties of |
JenkinsActionType | The type of the Jenkins Action that determines its CodePipeline Category - Build, or Test. |
JenkinsProvider | A class representing Jenkins providers. |
JenkinsProviderAttributes | Properties for importing an existing Jenkins provider. |
JenkinsProviderProps | |
LambdaInvokeAction | CodePipeline invoke Action that is provided by an AWS Lambda function. |
LambdaInvokeActionProps | Construction properties of the |
ManualApprovalAction | Manual approval action. |
ManualApprovalActionProps | Construction properties of the |
OrganizationsDeploymentProps | Properties for configuring service-managed (Organizations) permissions. |
S3DeployAction | Deploys the sourceArtifact to Amazon S3. |
S3DeployActionProps | Construction properties of the |
S3SourceAction | Source that is provided by a specific Amazon S3 object. |
S3SourceActionProps | Construction properties of the |
S3SourceVariables | The CodePipeline variables emitted by the S3 source Action. |
S3Trigger | How should the S3 Action detect changes. |
SelfManagedDeploymentProps | Properties for configuring self-managed permissions. |
ServiceCatalogDeployActionBeta1 | CodePipeline action to connect to an existing ServiceCatalog product. |
ServiceCatalogDeployActionBeta1Props | Construction properties of the |
StackInstances | Where Stack Instances will be created from the StackSet. |
StackSetDeploymentModel | Determines how IAM roles are created and managed. |
StackSetOrganizationsAutoDeployment | Describes whether AWS CloudFormation StackSets automatically deploys to AWS Organizations accounts that are added to a target organization or organizational unit (OU). |
StackSetParameters | Base parameters for the StackSet. |
StackSetTemplate | The source of a StackSet template. |
StateMachineInput | Represents the input for the StateMachine. |
StepFunctionInvokeAction | StepFunctionInvokeAction that is provided by an AWS CodePipeline. |
StepFunctionsInvokeActionProps | Construction properties of the |
Interfaces
IAlexaSkillDeployActionProps | Construction properties of the |
ICloudFormationCreateReplaceChangeSetActionProps | Properties for the CloudFormationCreateReplaceChangeSetAction. |
ICloudFormationCreateUpdateStackActionProps | Properties for the CloudFormationCreateUpdateStackAction. |
ICloudFormationDeleteStackActionProps | Properties for the CloudFormationDeleteStackAction. |
ICloudFormationDeployStackInstancesActionProps | Properties for the CloudFormationDeployStackInstancesAction. |
ICloudFormationDeployStackSetActionProps | Properties for the CloudFormationDeployStackSetAction. |
ICloudFormationExecuteChangeSetActionProps | Properties for the CloudFormationExecuteChangeSetAction. |
ICodeBuildActionProps | Construction properties of the |
ICodeCommitSourceActionProps | Construction properties of the |
ICodeCommitSourceVariables | The CodePipeline variables emitted by the CodeCommit source Action. |
ICodeDeployEcsContainerImageInput | Configuration for replacing a placeholder string in the ECS task definition template file with an image URI. |
ICodeDeployEcsDeployActionProps | Construction properties of the |
ICodeDeployServerDeployActionProps | Construction properties of the |
ICodeStarConnectionsSourceActionProps | Construction properties for |
ICodeStarSourceVariables | The CodePipeline variables emitted by CodeStar source Action. |
ICommonCloudFormationStackSetOptions | Options in common between both StackSet actions. |
ICustomEventRule | Represents a custom event rule in AWS CodePipeline Actions. |
IEcrSourceActionProps | Construction properties of |
IEcrSourceVariables | The CodePipeline variables emitted by the ECR source Action. |
IEcsDeployActionProps | Construction properties of |
IElasticBeanstalkDeployActionProps | Construction properties of the |
IGitHubSourceActionProps | Construction properties of the |
IGitHubSourceVariables | The CodePipeline variables emitted by GitHub source Action. |
IJenkinsActionProps | Construction properties of |
IJenkinsProvider | A Jenkins provider. |
IJenkinsProviderAttributes | Properties for importing an existing Jenkins provider. |
IJenkinsProviderProps | |
ILambdaInvokeActionProps | Construction properties of the |
IManualApprovalActionProps | Construction properties of the |
IOrganizationsDeploymentProps | Properties for configuring service-managed (Organizations) permissions. |
IS3DeployActionProps | Construction properties of the |
IS3SourceActionProps | Construction properties of the |
IS3SourceVariables | The CodePipeline variables emitted by the S3 source Action. |
ISelfManagedDeploymentProps | Properties for configuring self-managed permissions. |
IServiceCatalogDeployActionBeta1Props | Construction properties of the |
IStepFunctionsInvokeActionProps | Construction properties of the |