Skip to content
v2.278.0

DeploymentLifecycleHookProperty Struct ​

A deployment lifecycle hook runs custom logic at specific stages of the deployment process.

Currently, you can use Lambda functions as hook targets.

For more information, see Lifecycle hooks for Amazon ECS service deployments in the Amazon Elastic Container Service Developer Guide .

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ecs as ecs } from 'aws-cdk-lib';

declare const hookDetails: any;
const deploymentLifecycleHookProperty: ecs.CfnService.DeploymentLifecycleHookProperty = {
  lifecycleStages: ['lifecycleStages'],

  // the properties below are optional
  hookDetails: hookDetails,
  hookTargetArn: 'hookTargetArn',
  roleArn: 'roleArn',
  targetType: 'targetType',
  timeoutConfiguration: {
    action: 'action',
    timeoutInMinutes: 123,
  },
};
python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ecs as ecs

# hook_details: Any

deployment_lifecycle_hook_property = ecs.CfnService.DeploymentLifecycleHookProperty(
    lifecycle_stages=["lifecycleStages"],

    # the properties below are optional
    hook_details=hook_details,
    hook_target_arn="hookTargetArn",
    role_arn="roleArn",
    target_type="targetType",
    timeout_configuration=ecs.CfnService.HookTimeoutConfigProperty(
        action="action",
        timeout_in_minutes=123
    )
)
java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ecs.*;

Object hookDetails;

DeploymentLifecycleHookProperty deploymentLifecycleHookProperty = DeploymentLifecycleHookProperty.builder()
        .lifecycleStages(List.of("lifecycleStages"))

        // the properties below are optional
        .hookDetails(hookDetails)
        .hookTargetArn("hookTargetArn")
        .roleArn("roleArn")
        .targetType("targetType")
        .timeoutConfiguration(HookTimeoutConfigProperty.builder()
                .action("action")
                .timeoutInMinutes(123)
                .build())
        .build();
csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.ECS;

var hookDetails;

var deploymentLifecycleHookProperty = new DeploymentLifecycleHookProperty {
    LifecycleStages = new [] { "lifecycleStages" },

    // the properties below are optional
    HookDetails = hookDetails,
    HookTargetArn = "hookTargetArn",
    RoleArn = "roleArn",
    TargetType = "targetType",
    TimeoutConfiguration = new HookTimeoutConfigProperty {
        Action = "action",
        TimeoutInMinutes = 123
    }
};
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

var hookDetails interface{}

deploymentLifecycleHookProperty := &DeploymentLifecycleHookProperty{
	LifecycleStages: []*string{
		jsii.String("lifecycleStages"),
	},

	// the properties below are optional
	HookDetails: hookDetails,
	HookTargetArn: jsii.String("hookTargetArn"),
	RoleArn: jsii.String("roleArn"),
	TargetType: jsii.String("targetType"),
	TimeoutConfiguration: &HookTimeoutConfigProperty{
		Action: jsii.String("action"),
		TimeoutInMinutes: jsii.Number(123),
	},
}

Properties ​

hookDetailsoptionalanyhook_detailsoptionalAnyhookDetailsoptionalObjectHookDetailsoptionalobjectHookDetailsoptionalinterface{} #
Use this field to specify custom parameters that Amazon ECS passes to your hook target invocations (such as a Lambda function).

This field must be a JSON object as a string.

hookTargetArnoptionalstringhook_target_arnoptionalstrhookTargetArnoptionalStringHookTargetArnoptionalstringHookTargetArnoptional*string #
The Amazon Resource Name (ARN) of the hook target. Currently, only Lambda function ARNs are supported.

You must provide this parameter when configuring a deployment lifecycle hook.

lifecycleStagesstring[]lifecycle_stagestyping.List[str]lifecycleStagesList<String>LifecycleStagesstring[]LifecycleStages*[]*string required #
The lifecycle stages at which to run the hook. Choose from these valid values:.
notes
  • RECONCILE_SERVICE

The reconciliation stage that only happens when you start a new service deployment with more than 1 service revision in an ACTIVE state.

You can use a lifecycle hook for this stage.

  • PRE_SCALE_UP

The green service revision has not started. The blue service revision is handling 100% of the production traffic. There is no test traffic.

You can use a lifecycle hook for this stage.

  • POST_SCALE_UP

The green service revision has started. The blue service revision is handling 100% of the production traffic. There is no test traffic.

You can use a lifecycle hook for this stage.

  • TEST_TRAFFIC_SHIFT

The blue and green service revisions are running. The blue service revision handles 100% of the production traffic. The green service revision is migrating from 0% to 100% of test traffic.

You can use a lifecycle hook for this stage.

  • POST_TEST_TRAFFIC_SHIFT

The test traffic shift is complete. The green service revision handles 100% of the test traffic.

You can use a lifecycle hook for this stage.

  • PRODUCTION_TRAFFIC_SHIFT

Production traffic is shifting to the green service revision. The green service revision is migrating from 0% to 100% of production traffic.

You can use a lifecycle hook for this stage.

  • POST_PRODUCTION_TRAFFIC_SHIFT

The production traffic shift is complete.

You can use a lifecycle hook for this stage.

You must provide this parameter when configuring a deployment lifecycle hook.

roleArnoptionalstringrole_arnoptionalstrroleArnoptionalStringRoleArnoptionalstringRoleArnoptional*string #
The Amazon Resource Name (ARN) of the IAM role that grants Amazon ECS permission to call Lambda functions on your behalf.
notes

For more information, see Permissions required for Lambda functions in Amazon ECS blue/green deployments in the Amazon Elastic Container Service Developer Guide .

targetTypeoptionalstringtarget_typeoptionalstrtargetTypeoptionalStringTargetTypeoptionalstringTargetTypeoptional*string #
The type of action the lifecycle hook performs.
notes

Valid values are:

  • AWS_LAMBDA - Invokes a Lambda function at the specified lifecycle stage. This is the default value.
  • PAUSE - Pauses the deployment at the specified lifecycle stage until you call ContinueServiceDeployment to continue or roll back.

This field is optional. If not specified, the default value is AWS_LAMBDA.

timeoutConfigurationoptionalIResolvable | CfnService.HookTimeoutConfigPropertytimeout_configurationoptionaltyping.Union[IResolvable, HookTimeoutConfigProperty]timeoutConfigurationoptionalIResolvableTimeoutConfigurationoptionalIResolvableTimeoutConfigurationoptionalinterface{} #