LambdaDeploymentGroup

class aws_cdk.aws_codedeploy.LambdaDeploymentGroup(scope, id, *, alias, alarms=None, application=None, auto_rollback=None, deployment_config=None, deployment_group_name=None, ignore_poll_alarms_failure=None, post_hook=None, pre_hook=None, role=None)

Bases: Resource

Resource:

AWS::CodeDeploy::DeploymentGroup

ExampleMetadata:

infused

Example:

# application: codedeploy.LambdaApplication
# alias: lambda.Alias
config = codedeploy.CustomLambdaDeploymentConfig(self, "CustomConfig",
    type=codedeploy.CustomLambdaDeploymentConfigType.CANARY,
    interval=Duration.minutes(1),
    percentage=5
)
deployment_group = codedeploy.LambdaDeploymentGroup(self, "BlueGreenDeployment",
    application=application,
    alias=alias,
    deployment_config=config
)
Parameters:
  • scope (Construct) –

  • id (str) –

  • alias (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 (Optional[Sequence[IAlarm]]) – 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 {@link #addAlarm} method. Default: []

  • application (Optional[ILambdaApplication]) – The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to. Default: - One will be created for you.

  • auto_rollback (Union[AutoRollbackConfig, Dict[str, Any], None]) – The auto-rollback configuration for this Deployment Group. Default: - default AutoRollbackConfig.

  • deployment_config (Optional[ILambdaDeploymentConfig]) – The Deployment Configuration this Deployment Group uses. Default: LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES

  • deployment_group_name (Optional[str]) – The physical, human-readable name of the CodeDeploy Deployment Group. Default: - An auto-generated name will be used.

  • ignore_poll_alarms_failure (Optional[bool]) – Whether to continue a deployment even if fetching the alarm status from CloudWatch failed. Default: false

  • post_hook (Optional[IFunction]) – The Lambda function to run after traffic routing starts. Default: - None.

  • pre_hook (Optional[IFunction]) – The Lambda function to run before traffic routing starts. Default: - None.

  • role (Optional[IRole]) – The service Role of this Deployment Group. Default: - A new Role will be created.

Methods

add_alarm(alarm)

Associates an additional alarm with this Deployment Group.

Parameters:

alarm (IAlarm) – the alarm to associate with this Deployment Group.

Return type:

None

add_post_hook(post_hook)

Associate a function to run after deployment completes.

Parameters:

post_hook (IFunction) – function to run after deployment completes.

Throws:

an error if a post-hook function is already configured

Return type:

None

add_pre_hook(pre_hook)

Associate a function to run before deployment begins.

Parameters:

pre_hook (IFunction) – function to run before deployment beings.

Throws:

an error if a pre-hook function is already configured

Return type:

None

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

Parameters:

policy (RemovalPolicy) –

Return type:

None

grant_put_lifecycle_event_hook_execution_status(grantee)

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

Parameters:

grantee (IGrantable) – to grant permission to.

Return type:

Grant

to_string()

Returns a string representation of this construct.

Return type:

str

Attributes

application

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

deployment_config

The Deployment Configuration this Group uses.

deployment_group_arn

The ARN of this Deployment Group.

deployment_group_name

The physical name of the CodeDeploy Deployment Group.

env

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

The construct tree node associated with this construct.

role
stack

The stack in which this resource is defined.

Static Methods

classmethod from_lambda_deployment_group_attributes(scope, id, *, application, deployment_group_name, deployment_config=None)

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

Parameters:
  • scope (Construct) – the parent Construct for this new Construct.

  • id (str) – the logical ID of this new Construct.

  • application (ILambdaApplication) – The reference to the CodeDeploy Lambda Application that this Deployment Group belongs to.

  • deployment_group_name (str) – The physical, human-readable name of the CodeDeploy Lambda Deployment Group that we are referencing.

  • deployment_config (Optional[ILambdaDeploymentConfig]) – The Deployment Configuration this Deployment Group uses. Default: LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES

Return type:

ILambdaDeploymentGroup

Returns:

a Construct representing a reference to an existing Deployment Group

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters:

x (Any) –

Return type:

bool

classmethod is_resource(construct)

Check whether the given construct is a Resource.

Parameters:

construct (IConstruct) –

Return type:

bool