class LambdaDeploymentGroup (construct)
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.CodeDeploy.LambdaDeploymentGroup |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awscodedeploy#LambdaDeploymentGroup |
![]() | software.amazon.awscdk.services.codedeploy.LambdaDeploymentGroup |
![]() | aws_cdk.aws_codedeploy.LambdaDeploymentGroup |
![]() | aws-cdk-lib » aws_codedeploy » LambdaDeploymentGroup |
Implements
IConstruct
, IDependable
, IResource
, ILambda
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
Lambda
Deployment Group Props
Construct Props
Name | Type | Description |
---|---|---|
alias | Alias | Lambda 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? | ILambda | The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to. |
auto | Auto | The auto-rollback configuration for this Deployment Group. |
deployment | ILambda | The Deployment Configuration this Deployment Group uses. |
deployment | string | The physical, human-readable name of the CodeDeploy Deployment Group. |
ignore | boolean | Whether to skip the step of checking CloudWatch alarms during the deployment process. |
ignore | boolean | Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. |
post | IFunction | The Lambda function to run after traffic routing starts. |
pre | IFunction | The Lambda function to run before traffic routing starts. |
role? | IRole | The 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:
ILambda
(optional, default: One will be created for you.)
The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to.
autoRollback?
Type:
Auto
(optional, default: default AutoRollbackConfig.)
The auto-rollback configuration for this Deployment Group.
deploymentConfig?
Type:
ILambda
(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.
ignoreAlarmConfiguration?
Type:
boolean
(optional, default: false)
Whether to skip the step of checking CloudWatch alarms during the deployment process.
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
Name | Type | Description |
---|---|---|
application | ILambda | The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to. |
deployment | ILambda | The Deployment Configuration this Group uses. |
deployment | string | The ARN of the Deployment Group. |
deployment | string | The name of the Deployment Group. |
env | Resource | The environment this resource belongs to. |
node | Node | The tree node. |
role | IRole | The service Role of this Deployment Group. |
stack | Stack | The stack in which this resource is defined. |
application
Type:
ILambda
The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to.
deploymentConfig
Type:
ILambda
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:
Resource
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
Name | Description |
---|---|
add | Associates an additional alarm with this Deployment Group. |
add | Associate a function to run after deployment completes. |
add | Associate a function to run before deployment begins. |
apply | Apply the given removal policy to this resource. |
grant | Grant a principal permission to codedeploy:PutLifecycleEventHookExecutionStatus on this deployment group resource. |
to | Returns a string representation of this construct. |
static from | 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
Removal
Policy
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 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
Lambda
— the properties of the referenced Deployment Group.Deployment Group Attributes
Returns
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.