AwsCodeDeploy

Service-level AWS CodeDeploy component for ECS blue/green deployments.

Remarks

This component creates an ECS CodeDeploy application and deployment group. It requires two existing target groups and one production listener; CodeDeploy switches the listener between those target groups during a deployment.

Defaults enable rollback on deployment failure, use BLUE_GREEN with WITH_TRAFFIC_CONTROL, continue automatically when replacement tasks are ready, and terminate the previous task set after zero minutes to improve deployment speed.

Naming:

  • Root type ${namespace}:aws:AwsCodeDeploy has capability codedeploy-ecs-blue-green, raw shared identity args.ecsBlueGreen.name, and target ${env}-${projectHash}-codedeploy-ecs-blue-green-${sanitiseNamePart(args.ecsBlueGreen.name)}.
  • aws:codedeploy/application:Application and aws:codedeploy/deploymentGroup:DeploymentGroup have parent ${namespace}:aws:AwsCodeDeploy, tuple [args.ecsBlueGreen.name], and target ${env}-${projectHash}-${sanitiseNamePart(args.ecsBlueGreen.name)}.
  • Application and deployment-group provider names use stackAndPurpose with args.ecsBlueGreen.name; the exact result is ${env}-${projectHash}-${purpose}. The shared purpose is limited to 40 characters by IAM's 64-character role-name limit.
  • The composed IAM role is owned by AwsIam; its naming contract is defined by that component.

Example

CODE
const deployment = new AwsCodeDeploy({
  ecsBlueGreen: {
    name: 'payments',
    ecsService: paymentsService,
    productionListener: applicationLoadBalancer.codeDeployListenersByKey.https!,
    targetGroups: {
      blue: blueTargetGroup.targetGroup!,
      green: greenTargetGroup.targetGroup!,
    },
  },
});

Constructors

new AwsCodeDeploy( args: AwsCodeDeployEcsBlueGreenCapabilityArgs, options?: ComponentResourceOptions, ): AwsCodeDeploy

Parameters

  • args (AwsCodeDeployEcsBlueGreenCapabilityArgs) — ECS blue/green deployment arguments.
  • options (ComponentResourceOptions, optional) — Optional settings controlling resource behaviour.

Returns

AwsCodeDeploy

Hierarchy

  • ComponentResource
  • AwsCodeDeploy

Properties

applicationArn: Output<string>

readonly

CodeDeploy application ARN.

applicationName: Output<string>

readonly

CodeDeploy application name.

deploymentGroupArn: Output<string>

readonly

CodeDeploy deployment-group ARN.

deploymentGroupId: Output<string>

readonly

CodeDeploy deployment-group ID.

deploymentGroupName: Output<string>

readonly

CodeDeploy deployment-group name.

serviceRole: AwsIam

readonly

IAM role created with the required CodeDeploy trust and managed policy.

urn: Output<string>

readonly

Inherited from urn

The stable logical URN used to distinctly address a resource, both before and after deployments.

Methods

getData(): Promise<any>

protectedasync

Inherited from getData

Retrieves the data produces by initialize. The data is immediately available in a derived class's constructor after the super(...) call to ComponentResource.

Returns

  • Promise<any>

getProvider(moduleMember: string): ProviderResource | undefined

Inherited from getProvider

Returns the provider for the given module member, if one exists.

Parameters

  • moduleMember (string)

Returns

  • ProviderResource | undefined

initialize( args: Inputs, opts?: ComponentResourceOptions, name?: string, type?: string, ): Promise<any>

protectedasync

Inherited from initialize

Can be overridden by a subclass to asynchronously initialize data for this component automatically when constructed. The data will be available immediately for subclass constructors to use. To access the data use getData.

Parameters

  • args (Inputs)
  • opts (ComponentResourceOptions, optional)
  • name (string, optional)
  • type (string, optional)

Returns

  • Promise<any>

registerOutputs( outputs?: Inputs | Promise<Inputs> | Output<Inputs>, ): void

protected

Inherited from registerOutputs

Registers synthetic outputs that a component has initialized, usually by allocating other child sub-resources and propagating their resulting property values.

Component resources can call this at the end of their constructor to indicate that they are done creating child resources. This is not strictly necessary as this will automatically be called after the initialize method completes.

Parameters

  • outputs (Inputs | Promise<Inputs> | Output<Inputs>, optional)

Returns

  • void

Static Methods

isInstance(obj: any): obj is ComponentResource<any>

static

Inherited from isInstance

Returns true if the given object is a CustomResource. This is designed to work even when multiple copies of the Pulumi SDK have been loaded into the same process.

Parameters

  • obj (any)

Returns

  • obj is ComponentResource<any>