cdklabscdkecscodedeploy

package module
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 19, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

README

CDK ECS CodeDeploy

npm version Maven Central PyPI version NuGet version Gitpod Ready-to-Code Mergify

This project contains CDK constructs to create CodeDeploy ECS deployments.

Installation

TypeScript
yarn add @cdklabs/cdk-ecs-codedeploy
Java

See https://mvnrepository.com/artifact/io.github.cdklabs/cdk-ecs-codedeploy

Python

See https://pypi.org/project/cdklabs.ecs-codedeploy/

C#

See https://www.nuget.org/packages/Cdklabs.CdkEcsCodeDeploy/

Getting Started

You can browse the documentation at https://constructs.dev/packages/cdk-ecs-codedeploy/

CodeDeploy for ECS can manage the deployment of new task definitions to ECS services. Only 1 deployment construct can be defined for a given EcsDeploymentGroup.

declare const deploymentGroup: codeDeploy.IEcsDeploymentGroup;
declare const taskDefinition: ecs.ITaskDefinition;

EcsDeployment.forDeploymentGroup({
  deploymentGroup,
  appspec: new codedeploy.EcsAppSpec({
    taskDefinition,
    containerName: 'mycontainer',
    containerPort: 80,
  }),
});

The deployment will use the AutoRollbackConfig for the EcsDeploymentGroup unless it is overridden in the deployment:

EcsDeployment.forDeploymentGroup({
  deploymentGroup,
  appspec: new codedeploy.EcsAppSpec({
    taskDefinition,
    containerName: 'mycontainer',
    containerPort: 80,
  }),
  autoRollback: {
    failedDeployment: true,
    deploymentInAlarm: true,
    stoppedDeployment: false,
  },
});

By default, the deployment will timeout after 30 minutes. The timeout value can be overridden:

EcsDeployment.forDeploymentGroup({
  deploymentGroup,
  appspec: new codedeploy.EcsAppSpec({
    taskDefinition,
    containerName: 'mycontainer',
    containerPort: 80,
  }),
  timeout: Duration.minutes(60),
});

Local Development

yarn install
yarn build
yarn test

To run an integration test and update the snapshot, run:

yarn integ:deployment:deploy

To recreate snapshots for integration tests, run:

yarn integ:snapshot-all

Security

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Documentation

Overview

CDK Constructs for performing ECS Deployments with CodeDeploy

CDK Constructs for performing ECS Deployments with CodeDeploy

CDK Constructs for performing ECS Deployments with CodeDeploy

CDK Constructs for performing ECS Deployments with CodeDeploy

CDK Constructs for performing ECS Deployments with CodeDeploy

CDK Constructs for performing ECS Deployments with CodeDeploy

CDK Constructs for performing ECS Deployments with CodeDeploy

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EcsDeployment_IsConstruct

func EcsDeployment_IsConstruct(x interface{}) *bool

Checks if `x` is a construct.

Returns: true if `x` is an object created from a class which extends `Construct`. Deprecated: use `x instanceof Construct` instead.

func NewEcsAppSpec_Override

func NewEcsAppSpec_Override(e EcsAppSpec, targetService *TargetService)

Experimental.

func NewEcsDeployment_Override

func NewEcsDeployment_Override(e EcsDeployment, scope constructs.Construct, id *string, props *EcsDeploymentProps)

Experimental.

Types

type AwsvpcConfiguration

type AwsvpcConfiguration struct {
	// Assign a public IP address to the task.
	// Experimental.
	AssignPublicIp *bool `field:"required" json:"assignPublicIp" yaml:"assignPublicIp"`
	// The Security Groups to use for the task.
	// Experimental.
	SecurityGroups *[]awsec2.ISecurityGroup `field:"required" json:"securityGroups" yaml:"securityGroups"`
	// The VPC to use for the task.
	// Experimental.
	Vpc awsec2.IVpc `field:"required" json:"vpc" yaml:"vpc"`
	// The Subnets to use for the task.
	// Experimental.
	VpcSubnets *awsec2.SubnetSelection `field:"required" json:"vpcSubnets" yaml:"vpcSubnets"`
}

Network configuration for ECS services that have a network type of `awsvpc`. Experimental.

type EcsAppSpec

type EcsAppSpec interface {
	// Render JSON string for this AppSpec to be used.
	//
	// Returns: string representation of this AppSpec.
	// Experimental.
	ToString() *string
}

Represents an AppSpec to be used for ECS services.

see: https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-resources.html#reference-appspec-file-structure-resources-ecs Experimental.

func NewEcsAppSpec

func NewEcsAppSpec(targetService *TargetService) EcsAppSpec

Experimental.

type EcsDeployment

type EcsDeployment interface {
	constructs.Construct
	// The id of the deployment that was created.
	// Experimental.
	DeploymentId() *string
	// Experimental.
	SetDeploymentId(val *string)
	// The tree node.
	// Experimental.
	Node() constructs.Node
	// Returns a string representation of this construct.
	// Experimental.
	ToString() *string
}

A CodeDeploy Deployment for a Amazon ECS service DeploymentGroup.

An EcsDeploymentGroup must only have 1 EcsDeployment. This limit is enforced by making the constructor protected and requiring the use of a static method such as `EcsDeploymentGroup.forDeploymentGroup()` to initialize. The scope will always be set to the EcsDeploymentGroup and the id will always be set to the string 'Deployment' to force an error if mulitiple EcsDeployment constructs are created for a single EcsDeploymentGroup. Experimental.

func EcsDeployment_ForDeploymentGroup

func EcsDeployment_ForDeploymentGroup(props *EcsDeploymentProps) EcsDeployment

Create a new deployment for a given `EcsDeploymentGroup`. Experimental.

func NewEcsDeployment

func NewEcsDeployment(scope constructs.Construct, id *string, props *EcsDeploymentProps) EcsDeployment

Experimental.

type EcsDeploymentProps

type EcsDeploymentProps struct {
	// The AppSpec to use for the deployment.
	//
	// see: https://docs.aws.amazon.com/codedeploy/latest/userguide/reference-appspec-file-structure-resources.html#reference-appspec-file-structure-resources-ecs
	// Experimental.
	Appspec EcsAppSpec `field:"required" json:"appspec" yaml:"appspec"`
	// The deployment group to target for this deployment.
	// Experimental.
	DeploymentGroup awscodedeploy.IEcsDeploymentGroup `field:"required" json:"deploymentGroup" yaml:"deploymentGroup"`
	// The configuration for rollback in the event that a deployment fails.
	// Experimental.
	AutoRollback *awscodedeploy.AutoRollbackConfig `field:"optional" json:"autoRollback" yaml:"autoRollback"`
	// The description for the deployment.
	// Experimental.
	Description *string `field:"optional" json:"description" yaml:"description"`
	// The timeout for the deployment.
	//
	// If the timeout is reached, it will trigger a rollback of the stack.
	// Experimental.
	Timeout awscdk.Duration `field:"optional" json:"timeout" yaml:"timeout"`
}

Construction properties of EcsDeployment. Experimental.

type TargetService

type TargetService struct {
	// The name of the Amazon ECS container that contains your Amazon ECS application.
	//
	// It must be a container specified in your Amazon ECS task definition.
	// Experimental.
	ContainerName *string `field:"required" json:"containerName" yaml:"containerName"`
	// The port on the container where traffic will be routed to.
	// Experimental.
	ContainerPort *float64 `field:"required" json:"containerPort" yaml:"containerPort"`
	// The TaskDefintion to deploy to the target services.
	// Experimental.
	TaskDefinition awsecs.ITaskDefinition `field:"required" json:"taskDefinition" yaml:"taskDefinition"`
	// Network configuration for ECS services that have a network type of `awsvpc`.
	// Experimental.
	AwsvpcConfiguration *AwsvpcConfiguration `field:"optional" json:"awsvpcConfiguration" yaml:"awsvpcConfiguration"`
	// A list of Amazon ECS capacity providers to use for the deployment.
	// Experimental.
	CapacityProviderStrategy *[]*awsecs.CapacityProviderStrategy `field:"optional" json:"capacityProviderStrategy" yaml:"capacityProviderStrategy"`
	// The platform version of the Fargate tasks in the deployed Amazon ECS service.
	//
	// see: https://docs.aws.amazon.com/AmazonECS/latest/developerguide/platform_versions.html
	// Experimental.
	PlatformVersion awsecs.FargatePlatformVersion `field:"optional" json:"platformVersion" yaml:"platformVersion"`
}

Describe the target for CodeDeploy to use when creating a deployment for an ecs.EcsDeploymentGroup. Experimental.

Directories

Path Synopsis
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.
Package jsii contains the functionaility needed for jsii packages to initialize their dependencies and themselves.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL