LambdaDeploymentGroup L2 construct
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,
});
# application: codedeploy.LambdaApplication
# alias: lambda.Alias
config = codedeploy.LambdaDeploymentConfig(self, "CustomConfig",
traffic_routing=codedeploy.TimeBasedCanaryTrafficRouting(
interval=Duration.minutes(15),
percentage=5
)
)
deployment_group = codedeploy.LambdaDeploymentGroup(self, "BlueGreenDeployment",
application=application,
alias=alias,
deployment_config=config
)
LambdaApplication application;
Alias alias;
LambdaDeploymentConfig config = LambdaDeploymentConfig.Builder.create(this, "CustomConfig")
.trafficRouting(TimeBasedCanaryTrafficRouting.Builder.create()
.interval(Duration.minutes(15))
.percentage(5)
.build())
.build();
LambdaDeploymentGroup deploymentGroup = LambdaDeploymentGroup.Builder.create(this, "BlueGreenDeployment")
.application(application)
.alias(alias)
.deploymentConfig(config)
.build();
// Install: dotnet add package Amazon.CDK.Lib
LambdaApplication application;
Alias alias;
var config = new LambdaDeploymentConfig(this, "CustomConfig", new LambdaDeploymentConfigProps {
TrafficRouting = new TimeBasedCanaryTrafficRouting(new TimeBasedCanaryTrafficRoutingProps {
Interval = Duration.Minutes(15),
Percentage = 5
})
});
var deploymentGroup = new LambdaDeploymentGroup(this, "BlueGreenDeployment", new LambdaDeploymentGroupProps {
Application = application,
Alias = alias,
DeploymentConfig = config
});
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var application LambdaApplication
var alias Alias
config := codedeploy.NewLambdaDeploymentConfig(this, jsii.String("CustomConfig"), &LambdaDeploymentConfigProps{
TrafficRouting: codedeploy.NewTimeBasedCanaryTrafficRouting(&TimeBasedCanaryTrafficRoutingProps{
Interval: awscdk.Duration_Minutes(jsii.Number(15)),
Percentage: jsii.Number(5),
}),
})
deploymentGroup := codedeploy.NewLambdaDeploymentGroup(this, jsii.String("BlueGreenDeployment"), &LambdaDeploymentGroupProps{
Application: Application,
Alias: Alias,
DeploymentConfig: config,
})
Initializer
new LambdaDeploymentGroup(scope: Construct, id: string, props: LambdaDeploymentGroupProps)
LambdaDeploymentGroup(scope: Construct, id: str, props: LambdaDeploymentGroupProps)
new LambdaDeploymentGroup(Construct scope, String id, LambdaDeploymentGroupProps props)
new LambdaDeploymentGroup(Construct scope, string id, LambdaDeploymentGroupProps props)
NewLambdaDeploymentGroup(Scope Construct, Id *string, Props LambdaDeploymentGroupProps)
Construct Props
alarmsoptionalIAlarmRef[]alarmsoptionaltyping.List[IAlarmRef]alarmsoptionalList<IAlarmRef>AlarmsoptionalIAlarmRef[]Alarmsoptional*[]IAlarmRef= []#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.
[disable-awslint:ref-via-interface] since we need to modify the alias CFN resource update policy
applicationoptionalILambdaApplicationapplicationoptionalILambdaApplicationapplicationoptionalILambdaApplicationApplicationoptionalILambdaApplicationApplicationoptionalILambdaApplication#Default: One will be created for you.
autoRollbackoptionalAutoRollbackConfigauto_rollbackoptionalAutoRollbackConfigautoRollbackoptionalAutoRollbackConfigAutoRollbackoptionalAutoRollbackConfigAutoRollbackoptionalAutoRollbackConfig#Default: default AutoRollbackConfig.
deploymentConfigoptionalILambdaDeploymentConfigdeployment_configoptionalILambdaDeploymentConfigdeploymentConfigoptionalILambdaDeploymentConfigDeploymentConfigoptionalILambdaDeploymentConfigDeploymentConfigoptionalILambdaDeploymentConfig#Default: LambdaDeploymentConfig.CANARY_10PERCENT_5MINUTES
deploymentGroupNameoptionalstringdeployment_group_nameoptionalstrdeploymentGroupNameoptionalStringDeploymentGroupNameoptionalstringDeploymentGroupNameoptional*string#Default: An auto-generated name will be used.
ignoreAlarmConfigurationoptionalbooleanignore_alarm_configurationoptionalboolignoreAlarmConfigurationoptionalBooleanIgnoreAlarmConfigurationoptionalboolIgnoreAlarmConfigurationoptional*bool= false#ignorePollAlarmsFailureoptionalbooleanignore_poll_alarms_failureoptionalboolignorePollAlarmsFailureoptionalBooleanIgnorePollAlarmsFailureoptionalboolIgnorePollAlarmsFailureoptional*bool= false#postHookoptionalIFunctionpost_hookoptionalIFunctionpostHookoptionalIFunctionPostHookoptionalIFunctionPostHookoptionalIFunction= None.#Properties
applicationILambdaApplicationapplicationILambdaApplicationapplicationILambdaApplicationApplicationILambdaApplicationApplicationILambdaApplication#applicationNamestringapplication_namestrapplicationNameStringApplicationNamestringApplicationName*string#deploymentConfigILambdaDeploymentConfigdeployment_configILambdaDeploymentConfigdeploymentConfigILambdaDeploymentConfigDeploymentConfigILambdaDeploymentConfigDeploymentConfigILambdaDeploymentConfig#deploymentGroupArnstringdeployment_group_arnstrdeploymentGroupArnStringDeploymentGroupArnstringDeploymentGroupArn*string#deploymentGroupNamestringdeployment_group_namestrdeploymentGroupNameStringDeploymentGroupNamestringDeploymentGroupName*string#deploymentGroupRefDeploymentGroupReferencedeployment_group_refDeploymentGroupReferencedeploymentGroupRefDeploymentGroupReferenceDeploymentGroupRefDeploymentGroupReferenceDeploymentGroupRefDeploymentGroupReference#envResourceEnvironmentenvResourceEnvironmentenvResourceEnvironmentEnvResourceEnvironmentEnvResourceEnvironment#notes
For resources that are created and managed in a Stack (those created by creating new class instances like new Role(), new Bucket(), etc.), this is always the same as the environment of the stack they belong to.
For referenced resources (those obtained from referencing methods like Role.fromRoleArn(), Bucket.fromBucketName(), etc.), they might be different than the stack they were imported into.
PROPERTY_INJECTION_IDstringproperty_injection_idstrPROPERTY_INJECTION_IDStringPROPERTY_INJECTION_IDstringPROPERTY_INJECTION_ID*stringstatic#Methods
addAlarm(alarm: IAlarmRef): voiddef add_alarm(self, alarm: IAlarmRef) -> Nonepublic void addAlarm(IAlarmRef alarm)public void AddAlarm(IAlarmRef alarm)func AddAlarm(Alarm IAlarmRef)#1 parameter
Parameters
alarmalarmalarmalarmAlarm— the alarm to associate with this Deployment Group.
addPostHook(postHook: IFunction): voiddef add_post_hook(self, post_hook: IFunction) -> Nonepublic void addPostHook(IFunction postHook)public void AddPostHook(IFunction postHook)func AddPostHook(PostHook IFunction)#1 parameter
Parameters
postHookpost_hookpostHookpostHookPostHook— function to run after deployment completes.
addPreHook(preHook: IFunction): voiddef add_pre_hook(self, pre_hook: IFunction) -> Nonepublic void addPreHook(IFunction preHook)public void AddPreHook(IFunction preHook)func AddPreHook(PreHook IFunction)#1 parameter
Parameters
preHookpre_hookpreHookpreHookPreHook— function to run before deployment beings.
applyCrossStackReferenceStrength(strength: ReferenceStrength): voiddef apply_cross_stack_reference_strength(self, strength: ReferenceStrength) -> Nonepublic void applyCrossStackReferenceStrength(ReferenceStrength strength)public void ApplyCrossStackReferenceStrength(ReferenceStrength strength)func ApplyCrossStackReferenceStrength(Strength ReferenceStrength)#notes · 1 parameter
When set, any cross-stack reference to this resource will use the specified mechanism instead of the global default determined by the @aws-cdk/core:defaultCrossStackReferences context key. This is useful for selectively weakening specific references to avoid the "deadly embrace" problem without changing the app-wide default.
Parameters
strengthstrengthstrengthstrengthStrength— - The reference strength to use for this resource.
applyRemovalPolicy(policy: RemovalPolicy): voiddef apply_removal_policy(self, policy: RemovalPolicy) -> Nonepublic void applyRemovalPolicy(RemovalPolicy policy)public void ApplyRemovalPolicy(RemovalPolicy policy)func ApplyRemovalPolicy(Policy RemovalPolicy)#notes
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).
fromLambdaDeploymentGroupAttributes(scope: Construct, id: string, attrs: LambdaDeploymentGroupAttributes): ILambdaDeploymentGroup@staticmethod def from_lambda_deployment_group_attributes(scope: Construct, id: str, attrs: LambdaDeploymentGroupAttributes) -> ILambdaDeploymentGrouppublic static ILambdaDeploymentGroup fromLambdaDeploymentGroupAttributes(Construct scope, String id, LambdaDeploymentGroupAttributes attrs)public static ILambdaDeploymentGroup FromLambdaDeploymentGroupAttributes(Construct scope, string id, LambdaDeploymentGroupAttributes attrs)func FromLambdaDeploymentGroupAttributes(Scope Construct, Id *string, Attrs LambdaDeploymentGroupAttributes) ILambdaDeploymentGroupstatic#Account and region for the DeploymentGroup are taken from the application.
3 parameters · returns
Parameters
scopescopescopescopeScope— the parent Construct for this new Construct.ididididId— the logical ID of this new Construct.attrsattrsattrsattrsAttrs— the properties of the referenced Deployment Group.
Returns: a Construct representing a reference to an existing Deployment Group
grantPutLifecycleEventHookExecutionStatus(grantee: IGrantable): Grantdef grant_put_lifecycle_event_hook_execution_status(self, grantee: IGrantable) -> Grantpublic Grant grantPutLifecycleEventHookExecutionStatus(IGrantable grantee)public Grant GrantPutLifecycleEventHookExecutionStatus(IGrantable grantee)func GrantPutLifecycleEventHookExecutionStatus(Grantee IGrantable) Grant#[disable-awslint:no-grants]
1 parameter
Parameters
granteegranteegranteegranteeGrantee— to grant permission to.
isConstruct(x: any): boolean@staticmethod def is_construct(x: Any) -> boolpublic static Boolean isConstruct(Object x)public static bool IsConstruct(object x)func IsConstruct(X interface{}) *boolstatic#notes · 1 parameter · returns
Use this method instead of instanceof to properly detect Construct instances, even when the construct library is symlinked.
Explanation: in JavaScript, multiple copies of the constructs library on disk are seen as independent, completely different libraries. As a consequence, the class Construct in each copy of the constructs library is seen as a different class, and an instance of one class will not test as instanceof the other class. npm install will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of the constructs library can be accidentally installed, and instanceof will behave unpredictably. It is safest to avoid using instanceof, and using this type-testing method instead.
Parameters
xxxxX— Any object.
Returns: true if x is an object created from a class which extends Construct.
isOwnedResource(construct: IConstruct): boolean@staticmethod def is_owned_resource(construct: IConstruct) -> boolpublic static Boolean isOwnedResource(IConstruct construct)public static bool IsOwnedResource(IConstruct construct)func IsOwnedResource(Construct IConstruct) *boolstatic#isResource(construct: IConstruct): boolean@staticmethod def is_resource(construct: IConstruct) -> boolpublic static Boolean isResource(IConstruct construct)public static bool IsResource(IConstruct construct)func IsResource(Construct IConstruct) *boolstatic#toString(): stringdef to_string(self, ) -> strpublic String toString()public string ToString()func ToString() *string#with(...mixins: IMixin[]): IConstructdef with(self, mixins: IMixin) -> IConstructpublic IConstruct with(IMixin mixins)public IConstruct With(IMixin mixins)func With(Mixins IMixin) IConstruct#Mixins are applied in order. The list of constructs is captured at the start of the call, so constructs added by a mixin will not be visited. Use multiple with() calls if subsequent mixins should apply to added constructs.