Skip to content

AWS.CodeDeploy reference

Source: src/AWS/CodeDeploy/Application.ts

An AWS CodeDeploy application — a logical container that groups the deployment groups and revisions for a single deployable unit on a given compute platform (EC2/on-prem Server, Lambda, or ECS).

Lambda Application

const app = yield* CodeDeploy.Application("api", {
computePlatform: "Lambda",
});

EC2/On-Premises Application

const app = yield* CodeDeploy.Application("web", {
applicationName: "web-fleet",
computePlatform: "Server",
tags: { team: "platform" },
});

Source: src/AWS/CodeDeploy/BatchGetApplicationRevisions.ts

Runtime binding for codedeploy:BatchGetApplicationRevisions — reads up to 25 registered revisions of the bound application in one call.

BatchGetApplicationRevisions: Managing Revisions

Section titled “BatchGetApplicationRevisions: Managing Revisions”
const batchGetApplicationRevisions =
yield* AWS.CodeDeploy.BatchGetApplicationRevisions(app);
const { revisions } = yield* batchGetApplicationRevisions({
revisions: [revisionLocation],
});

Source: src/AWS/CodeDeploy/BatchGetDeployments.ts

Runtime binding for codedeploy:BatchGetDeployments — reads up to 25 deployments in one call. CodeDeploy authorizes the call against the deployment group the deployments belong to.

BatchGetDeployments: Observing Deployments

Section titled “BatchGetDeployments: Observing Deployments”
const batchGetDeployments = yield* AWS.CodeDeploy.BatchGetDeployments(group);
const { deploymentsInfo } = yield* batchGetDeployments({
deploymentIds: ["d-ABCDEF123", "d-GHIJKL456"],
});

Source: src/AWS/CodeDeploy/BatchGetDeploymentTargets.ts

Runtime binding for codedeploy:BatchGetDeploymentTargets — reads up to 25 deployment targets of a deployment in one call.

BatchGetDeploymentTargets: Observing Deployment Targets

Section titled “BatchGetDeploymentTargets: Observing Deployment Targets”
const batchGetDeploymentTargets =
yield* AWS.CodeDeploy.BatchGetDeploymentTargets(group);
const { deploymentTargets } = yield* batchGetDeploymentTargets({
deploymentId,
targetIds,
});

Source: src/AWS/CodeDeploy/ContinueDeployment.ts

Runtime binding for codedeploy:ContinueDeployment — for a blue/green deployment paused in the ready state (actionOnTimeout: "STOP_DEPLOYMENT"), starts rerouting traffic to the replacement environment without waiting for the configured wait time.

ContinueDeployment: Controlling Deployments

Section titled “ContinueDeployment: Controlling Deployments”
const continueDeployment = yield* AWS.CodeDeploy.ContinueDeployment(group);
yield* continueDeployment({
deploymentId,
deploymentWaitType: "READY_WAIT",
});

Source: src/AWS/CodeDeploy/CreateDeployment.ts

Runtime binding for codedeploy:CreateDeployment — lets a workload start a deployment through the bound deployment group (e.g. shifting a Lambda alias or rolling an EC2 fleet to a new revision).

The response carries the created deploymentId, which can be observed with the GetDeployment binding.

const createDeployment = yield* AWS.CodeDeploy.CreateDeployment(group);
const { deploymentId } = yield* createDeployment({
revision: {
revisionType: "S3",
s3Location: { bucket, key, bundleType: "zip" },
},
});

Source: src/AWS/CodeDeploy/DeploymentConfig.ts

A custom AWS CodeDeploy deployment configuration — the rules for how traffic shifts during a deployment (canary/linear traffic routing for Lambda/ECS, minimum-healthy-hosts and zonal rollout for Server). Deployment configurations are immutable: any change replaces the configuration.

DeploymentConfig: Creating a Deployment Config

Section titled “DeploymentConfig: Creating a Deployment Config”

Lambda Canary Config

const config = yield* CodeDeploy.DeploymentConfig("canary", {
computePlatform: "Lambda",
trafficRoutingConfig: {
type: "TimeBasedCanary",
timeBasedCanary: { canaryPercentage: 10, canaryInterval: 5 },
},
});

Server Config with Minimum Healthy Hosts

const config = yield* CodeDeploy.DeploymentConfig("half-fleet", {
computePlatform: "Server",
minimumHealthyHosts: { type: "FLEET_PERCENT", value: 50 },
});

Source: src/AWS/CodeDeploy/DeploymentGroup.ts

An AWS CodeDeploy deployment group — the set of target instances/functions plus the deployment configuration for one Application. For the Lambda compute platform a group ties a service role and a deployment config (e.g. CodeDeployDefault.LambdaAllAtOnce) to an application.

DeploymentGroup: Creating a Deployment Group

Section titled “DeploymentGroup: Creating a Deployment Group”
const app = yield* CodeDeploy.Application("api", { computePlatform: "Lambda" });
const group = yield* CodeDeploy.DeploymentGroup("prod", {
applicationName: app.applicationName,
serviceRoleArn: role.roleArn,
deploymentConfigName: "CodeDeployDefault.LambdaAllAtOnce",
deploymentStyle: {
deploymentType: "BLUE_GREEN",
deploymentOption: "WITH_TRAFFIC_CONTROL",
},
autoRollbackConfiguration: {
enabled: true,
events: ["DEPLOYMENT_FAILURE"],
},
});

Source: src/AWS/CodeDeploy/GetApplicationRevision.ts

Runtime binding for codedeploy:GetApplicationRevision — reads a registered revision’s metadata (description, deployment groups it was deployed to, first-seen time).

GetApplicationRevision: Managing Revisions

Section titled “GetApplicationRevision: Managing Revisions”
const getApplicationRevision =
yield* AWS.CodeDeploy.GetApplicationRevision(app);
const { revisionInfo } = yield* getApplicationRevision({
revision: {
revisionType: "S3",
s3Location: { bucket, key, bundleType: "zip" },
},
});

Source: src/AWS/CodeDeploy/GetDeployment.ts

Runtime binding for codedeploy:GetDeployment — reads a deployment’s status, revision, and rollout overview. CodeDeploy authorizes the call against the deployment group the deployment belongs to.

const getDeployment = yield* AWS.CodeDeploy.GetDeployment(group);
const { deploymentInfo } = yield* getDeployment({ deploymentId });

Source: src/AWS/CodeDeploy/GetDeploymentTarget.ts

Runtime binding for codedeploy:GetDeploymentTarget — reads one deployment target (instance, Lambda function, or ECS task set) of a deployment, including per-lifecycle-event status.

GetDeploymentTarget: Observing Deployment Targets

Section titled “GetDeploymentTarget: Observing Deployment Targets”
const getDeploymentTarget = yield* AWS.CodeDeploy.GetDeploymentTarget(group);
const { deploymentTarget } = yield* getDeploymentTarget({
deploymentId,
targetId,
});

Source: src/AWS/CodeDeploy/ListApplicationRevisions.ts

Runtime binding for codedeploy:ListApplicationRevisions — lists the revisions registered with the bound application (optionally filtered by S3 bucket/prefix or deployed state).

ListApplicationRevisions: Managing Revisions

Section titled “ListApplicationRevisions: Managing Revisions”
const listApplicationRevisions =
yield* AWS.CodeDeploy.ListApplicationRevisions(app);
const { revisions } = yield* listApplicationRevisions({
sortBy: "registerTime",
sortOrder: "descending",
});

Source: src/AWS/CodeDeploy/ListDeployments.ts

Runtime binding for codedeploy:ListDeployments — lists the deployment ids of the bound deployment group (optionally filtered by status or create-time range).

const listDeployments = yield* AWS.CodeDeploy.ListDeployments(group);
const { deployments } = yield* listDeployments({
includeOnlyStatuses: ["InProgress"],
});

Source: src/AWS/CodeDeploy/ListDeploymentTargets.ts

Runtime binding for codedeploy:ListDeploymentTargets — lists the target ids of a deployment (optionally filtered by target status).

ListDeploymentTargets: Observing Deployment Targets

Section titled “ListDeploymentTargets: Observing Deployment Targets”
const listDeploymentTargets =
yield* AWS.CodeDeploy.ListDeploymentTargets(group);
const { targetIds } = yield* listDeploymentTargets({
deploymentId,
targetFilters: { TargetStatus: ["Failed"] },
});

Source: src/AWS/CodeDeploy/PutLifecycleEventHookExecutionStatus.ts

Runtime binding for codedeploy:PutLifecycleEventHookExecutionStatus — the canonical CodeDeploy data-plane call: a Lambda validation hook (BeforeAllowTraffic/AfterAllowTraffic for Lambda deployments, plus BeforeInstall/AfterInstall/AfterAllowTestTraffic for ECS) reports Succeeded or Failed back to the paused deployment.

PutLifecycleEventHookExecutionStatus: Lifecycle Hooks

Section titled “PutLifecycleEventHookExecutionStatus: Lifecycle Hooks”
const putHookStatus =
yield* AWS.CodeDeploy.PutLifecycleEventHookExecutionStatus(group);
yield* putHookStatus({
deploymentId: event.DeploymentId,
lifecycleEventHookExecutionId: event.LifecycleEventHookExecutionId,
status: "Succeeded",
});

Source: src/AWS/CodeDeploy/RegisterApplicationRevision.ts

Runtime binding for codedeploy:RegisterApplicationRevision — registers a revision (S3 bundle or inline AppSpec) with the bound application so it shows up for deployment.

RegisterApplicationRevision: Managing Revisions

Section titled “RegisterApplicationRevision: Managing Revisions”
const registerApplicationRevision =
yield* AWS.CodeDeploy.RegisterApplicationRevision(app);
yield* registerApplicationRevision({
revision: {
revisionType: "S3",
s3Location: { bucket, key, bundleType: "zip" },
},
});

Source: src/AWS/CodeDeploy/StopDeployment.ts

Runtime binding for codedeploy:StopDeployment — attempts to stop an ongoing deployment of the bound deployment group (optionally rolling back).

const stopDeployment = yield* AWS.CodeDeploy.StopDeployment(group);
const { status } = yield* stopDeployment({
deploymentId,
autoRollbackEnabled: true,
});