aws-cdk-lib.aws_codedeploy.LambdaDeploymentGroup

class LambdaDeploymentGroup (construct)

LanguageType name
.NETAmazon.CDK.AWS.CodeDeploy.LambdaDeploymentGroup
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awscodedeploy#LambdaDeploymentGroup
Javasoftware.amazon.awscdk.services.codedeploy.LambdaDeploymentGroup
Pythonaws_cdk.aws_codedeploy.LambdaDeploymentGroup
TypeScript (source)aws-cdk-lib » aws_codedeploy » LambdaDeploymentGroup

Implements IConstruct, IDependable, IResource, ILambdaDeploymentGroup

Example

const config = new codedeploy.LambdaDeploymentConfig(this, 'CustomConfig', {
  trafficRouting: new codedeploy.TimeBasedCanaryTrafficRouting({
    interval: Duration.minutes(15),
    percentage: 5,
  }),
});

declare const application: codedeploy.LambdaApplication;
declare const alias: lambda.Alias;
const deploymentGroup = new codedeploy.LambdaDeploymentGroup(this, 'BlueGreenDeployment', {
  application,
  alias,
  deploymentConfig: config,
});

Initializer

new LambdaDeploymentGroup(scope: Construct, id: string, props: LambdaDeploymentGroupProps)

Parameters

  • scope Construct
  • id string
  • props LambdaDeploymentGroupProps

Construct Props

NameTypeDescription
aliasAliasLambda Alias to shift traffic. Updating the version of the alias will trigger a CodeDeploy deployment.
alarms?IAlarm[]The CloudWatch alarms associated with this Deployment Group.
application?ILambdaApplicationThe reference to the CodeDeploy Lambda Application that this Deployment Group belongs to.
autoRollback?AutoRollbackConfigThe auto-rollback configuration for this Deployment Group.
deploymentConfig?ILambdaDeploymentConfigThe Deployment Configuration this Deployment Group uses.
deploymentGroupName?stringThe physical, human-readable name of the CodeDeploy Deployment Group.
ignorePollAlarmsFailure?booleanWhether to continue a deployment even if fetching the alarm status from CloudWatch failed.
postHook?IFunctionThe Lambda function to run after traffic routing starts.
preHook?IFunctionThe Lambda function to run before traffic routing starts.
role?IRoleThe service Role of this Deployment Group.

alias

Type: Alias

Lambda Alias to shift traffic. Updating the version of the alias will trigger a CodeDeploy deployment.

[disable-awslint:ref-via-interface] since we need to modify the alias CFN resource update policy


alarms?

Type: IAlarm[] (optional, default: [])

The CloudWatch alarms associated with this Deployment Group.

CodeDeploy will stop (and optionally roll back) a deployment if during it any of the alarms trigger.

Alarms can also be added after the Deployment Group is created using the #addAlarm method.

See also: https://docs.aws.amazon.com/codedeploy/latest/userguide/monitoring-create-alarms.html


application?

Type: ILambdaApplication (optional, default: One will be created for you.)

The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to.


autoRollback?

Type: AutoRollbackConfig (optional, default: default AutoRollbackConfig.)

The auto-rollback configuration for this Deployment Group.


deploymentConfig?

Type: ILambdaDeploymentConfig (optional, default: LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES)

The Deployment Configuration this Deployment Group uses.


deploymentGroupName?

Type: string (optional, default: An auto-generated name will be used.)

The physical, human-readable name of the CodeDeploy Deployment Group.


ignorePollAlarmsFailure?

Type: boolean (optional, default: false)

Whether to continue a deployment even if fetching the alarm status from CloudWatch failed.


postHook?

Type: IFunction (optional, default: None.)

The Lambda function to run after traffic routing starts.


preHook?

Type: IFunction (optional, default: None.)

The Lambda function to run before traffic routing starts.


role?

Type: IRole (optional, default: A new Role will be created.)

The service Role of this Deployment Group.

Properties

NameTypeDescription
applicationILambdaApplicationThe reference to the CodeDeploy Lambda Application that this Deployment Group belongs to.
deploymentConfigILambdaDeploymentConfigThe Deployment Configuration this Group uses.
deploymentGroupArnstringThe ARN of the Deployment Group.
deploymentGroupNamestringThe name of the Deployment Group.
envResourceEnvironmentThe environment this resource belongs to.
nodeNodeThe tree node.
roleIRoleThe service Role of this Deployment Group.
stackStackThe stack in which this resource is defined.

application

Type: ILambdaApplication

The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to.


deploymentConfig

Type: ILambdaDeploymentConfig

The Deployment Configuration this Group uses.


deploymentGroupArn

Type: string

The ARN of the Deployment Group.


deploymentGroupName

Type: string

The name of the Deployment Group.


env

Type: ResourceEnvironment

The environment this resource belongs to.

For resources that are created and managed by the CDK (generally, those created by creating new class instances like Role, Bucket, etc.), this is always the same as the environment of the stack they belong to; however, for imported resources (those obtained from static methods like fromRoleArn, fromBucketName, etc.), that might be different than the stack they were imported into.


node

Type: Node

The tree node.


role

Type: IRole

The service Role of this Deployment Group.


stack

Type: Stack

The stack in which this resource is defined.

Methods

NameDescription
addAlarm(alarm)Associates an additional alarm with this Deployment Group.
addPostHook(postHook)Associate a function to run after deployment completes.
addPreHook(preHook)Associate a function to run before deployment begins.
applyRemovalPolicy(policy)Apply the given removal policy to this resource.
grantPutLifecycleEventHookExecutionStatus(grantee)Grant a principal permission to codedeploy:PutLifecycleEventHookExecutionStatus on this deployment group resource.
toString()Returns a string representation of this construct.
static fromLambdaDeploymentGroupAttributes(scope, id, attrs)Import an Lambda Deployment Group defined either outside the CDK app, or in a different AWS region.

addAlarm(alarm)

public addAlarm(alarm: IAlarm): void

Parameters

  • alarm IAlarm — the alarm to associate with this Deployment Group.

Associates an additional alarm with this Deployment Group.


addPostHook(postHook)

public addPostHook(postHook: IFunction): void

Parameters

  • postHook IFunction — function to run after deployment completes.

Associate a function to run after deployment completes.


addPreHook(preHook)

public addPreHook(preHook: IFunction): void

Parameters

  • preHook IFunction — function to run before deployment beings.

Associate a function to run before deployment begins.


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).


grantPutLifecycleEventHookExecutionStatus(grantee)

public grantPutLifecycleEventHookExecutionStatus(grantee: IGrantable): Grant

Parameters

  • grantee IGrantable — to grant permission to.

Returns

  • Grant

Grant a principal permission to codedeploy:PutLifecycleEventHookExecutionStatus on this deployment group resource.


toString()

public toString(): string

Returns

  • string

Returns a string representation of this construct.


static fromLambdaDeploymentGroupAttributes(scope, id, attrs)

public static fromLambdaDeploymentGroupAttributes(scope: Construct, id: string, attrs: LambdaDeploymentGroupAttributes): ILambdaDeploymentGroup

Parameters

  • scope Construct — the parent Construct for this new Construct.
  • id string — the logical ID of this new Construct.
  • attrs LambdaDeploymentGroupAttributes — the properties of the referenced Deployment Group.

Returns

  • ILambdaDeploymentGroup

Import an Lambda Deployment Group defined either outside the CDK app, or in a different AWS region.

Account and region for the DeploymentGroup are taken from the application.