0.0.414 • Published 6 months ago

@cdklabs/cdk-ecs-codedeploy v0.0.414

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
6 months ago

CDK ECS CodeDeploy

cdk-constructs: Experimental npm version Maven Central PyPI version NuGet version Gitpod Ready-to-Code Mergify

This project contains CDK constructs to create CodeDeploy ECS deployments.

Installation

yarn add @cdklabs/cdk-ecs-codedeploy

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

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

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

Deployments

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;

new EcsDeployment({
  deploymentGroup,
  targetService: {
    taskDefinition,
    containerName: 'mycontainer',
    containerPort: 80,
  },
});

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

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

new EcsDeployment({
  deploymentGroup,
  targetService: { 
    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:

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

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

API Canaries

CodeDeploy can leverage Cloudwatch Alarms to trigger automatic rollbacks. The ApiCanary construct simplifies the process for creating CloudWatch Synthetics Canaries to monitor APIs. The following code demonstrates a canary that monitors https://xkcd.com/908/info.0.json and checks the JSON response to assert that safe_title has the value of 'The Cloud'.

const canary = new ApiCanary(stack, 'Canary', {
  baseUrl: 'https://xkcd.com',
  durationAlarmThreshold: Duration.seconds(5),
  threadCount: 5,
  steps: [
    {
      name: 'info',
      path: '/908/info.0.json',
      jmesPath: 'safe_title',
      expectedValue: 'The Cloud',
    },
  ],
});

Application Load Balanced CodeDeployed Fargate Service

An L3 construct named ApplicationLoadBalancedCodeDeployedFargateService extends ApplicationLoadBalancedFargateService and adds support for deploying new versions of the service with AWS CodeDeploy. Additionally, an Amazon CloudWatch Synthetic canary is created via the ApiCanary construct and is monitored by the CodeDeploy deployment to trigger rollback if the canary begins to alarm.

declare const cluster: ecs.ICluster;
declare const image: ecs.ContainerImage;
const service = new ApplicationLoadBalancedCodeDeployedFargateService(stack, 'Service', {
  cluster,
  taskImageOptions: {
    image,
  },
  apiTestSteps: [{
    name: 'health',
    path: '/health',
    jmesPath: 'status',
    expectedValue: 'ok',
  }],
});

Local Development

yarn install
yarn build
yarn test

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

yarn integ:ecs-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.

0.0.348

1 year ago

0.0.347

1 year ago

0.0.346

1 year ago

0.0.345

1 year ago

0.0.349

1 year ago

0.0.403

7 months ago

0.0.402

7 months ago

0.0.401

7 months ago

0.0.400

7 months ago

0.0.407

7 months ago

0.0.406

7 months ago

0.0.405

7 months ago

0.0.404

7 months ago

0.0.414

6 months ago

0.0.413

6 months ago

0.0.412

6 months ago

0.0.411

6 months ago

0.0.410

6 months ago

0.0.409

6 months ago

0.0.408

7 months ago

0.0.395

7 months ago

0.0.394

7 months ago

0.0.393

7 months ago

0.0.392

7 months ago

0.0.399

7 months ago

0.0.398

7 months ago

0.0.397

7 months ago

0.0.396

7 months ago

0.0.391

7 months ago

0.0.390

8 months ago

0.0.359

11 months ago

0.0.358

11 months ago

0.0.357

12 months ago

0.0.356

12 months ago

0.0.351

12 months ago

0.0.350

1 year ago

0.0.355

12 months ago

0.0.354

12 months ago

0.0.353

12 months ago

0.0.352

12 months ago

0.0.369

11 months ago

0.0.368

11 months ago

0.0.367

11 months ago

0.0.362

11 months ago

0.0.361

11 months ago

0.0.360

11 months ago

0.0.366

11 months ago

0.0.365

11 months ago

0.0.364

11 months ago

0.0.363

11 months ago

0.0.379

9 months ago

0.0.378

10 months ago

0.0.373

10 months ago

0.0.372

10 months ago

0.0.371

10 months ago

0.0.370

11 months ago

0.0.377

10 months ago

0.0.376

10 months ago

0.0.375

10 months ago

0.0.374

10 months ago

0.0.389

8 months ago

0.0.384

9 months ago

0.0.383

9 months ago

0.0.382

9 months ago

0.0.381

9 months ago

0.0.388

8 months ago

0.0.387

8 months ago

0.0.386

8 months ago

0.0.385

8 months ago

0.0.380

9 months ago

0.0.344

1 year ago

0.0.343

1 year ago

0.0.342

1 year ago

0.0.340

1 year ago

0.0.341

1 year ago

0.0.339

1 year ago

0.0.338

1 year ago

0.0.337

1 year ago

0.0.326

1 year ago

0.0.329

1 year ago

0.0.328

1 year ago

0.0.327

1 year ago

0.0.336

1 year ago

0.0.335

1 year ago

0.0.334

1 year ago

0.0.333

1 year ago

0.0.332

1 year ago

0.0.331

1 year ago

0.0.330

1 year ago

0.0.319

1 year ago

0.0.318

1 year ago

0.0.317

1 year ago

0.0.325

1 year ago

0.0.324

1 year ago

0.0.323

1 year ago

0.0.322

1 year ago

0.0.321

1 year ago

0.0.320

1 year ago

0.0.315

1 year ago

0.0.314

1 year ago

0.0.313

1 year ago

0.0.312

1 year ago

0.0.316

1 year ago

0.0.311

1 year ago

0.0.310

1 year ago

0.0.309

1 year ago

0.0.304

1 year ago

0.0.303

1 year ago

0.0.302

1 year ago

0.0.301

1 year ago

0.0.308

1 year ago

0.0.307

1 year ago

0.0.306

1 year ago

0.0.305

1 year ago

0.0.300

1 year ago

0.0.285

2 years ago

0.0.284

2 years ago

0.0.283

2 years ago

0.0.282

2 years ago

0.0.289

1 year ago

0.0.288

1 year ago

0.0.287

1 year ago

0.0.286

1 year ago

0.0.296

1 year ago

0.0.295

1 year ago

0.0.294

1 year ago

0.0.293

1 year ago

0.0.299

1 year ago

0.0.298

1 year ago

0.0.297

1 year ago

0.0.292

1 year ago

0.0.291

1 year ago

0.0.290

1 year ago

0.0.281

2 years ago

0.0.280

2 years ago

0.0.279

2 years ago

0.0.278

2 years ago

0.0.277

2 years ago

0.0.276

2 years ago

0.0.275

2 years ago

0.0.274

2 years ago

0.0.273

2 years ago

0.0.272

2 years ago

0.0.271

2 years ago

0.0.270

2 years ago

0.0.269

2 years ago

0.0.268

2 years ago

0.0.267

2 years ago

0.0.266

2 years ago

0.0.265

2 years ago

0.0.264

2 years ago

0.0.263

2 years ago

0.0.262

2 years ago

0.0.261

2 years ago

0.0.260

2 years ago

0.0.259

2 years ago

0.0.258

2 years ago

0.0.257

2 years ago

0.0.256

2 years ago

0.0.255

2 years ago

0.0.254

2 years ago

0.0.252

2 years ago

0.0.251

2 years ago

0.0.253

2 years ago

0.0.250

2 years ago

0.0.249

2 years ago

0.0.248

2 years ago

0.0.247

2 years ago

0.0.246

2 years ago

0.0.245

2 years ago

0.0.244

2 years ago

0.0.243

2 years ago

0.0.242

2 years ago

0.0.241

2 years ago

0.0.240

2 years ago

0.0.239

2 years ago

0.0.238

2 years ago

0.0.237

2 years ago

0.0.236

2 years ago

0.0.235

2 years ago

0.0.234

2 years ago

0.0.233

2 years ago

0.0.232

2 years ago

0.0.231

2 years ago

0.0.230

2 years ago

0.0.229

2 years ago

0.0.228

2 years ago

0.0.227

2 years ago

0.0.226

2 years ago

0.0.225

2 years ago

0.0.224

2 years ago

0.0.223

2 years ago

0.0.222

2 years ago

0.0.221

2 years ago

0.0.219

2 years ago

0.0.220

2 years ago

0.0.218

2 years ago

0.0.216

2 years ago

0.0.215

2 years ago

0.0.214

2 years ago

0.0.213

2 years ago

0.0.217

2 years ago

0.0.209

2 years ago

0.0.208

2 years ago

0.0.207

2 years ago

0.0.212

2 years ago

0.0.211

2 years ago

0.0.210

2 years ago

0.0.205

2 years ago

0.0.206

2 years ago

0.0.204

2 years ago

0.0.203

2 years ago

0.0.202

2 years ago

0.0.201

2 years ago

0.0.200

2 years ago

0.0.197

2 years ago

0.0.196

2 years ago

0.0.195

2 years ago

0.0.194

2 years ago

0.0.199

2 years ago

0.0.198

2 years ago

0.0.193

2 years ago

0.0.192

2 years ago

0.0.191

2 years ago

0.0.190

2 years ago

0.0.179

2 years ago

0.0.178

2 years ago

0.0.186

2 years ago

0.0.185

2 years ago

0.0.184

2 years ago

0.0.183

2 years ago

0.0.189

2 years ago

0.0.188

2 years ago

0.0.187

2 years ago

0.0.182

2 years ago

0.0.181

2 years ago

0.0.180

2 years ago

0.0.159

3 years ago

0.0.158

3 years ago

0.0.153

3 years ago

0.0.152

3 years ago

0.0.151

3 years ago

0.0.150

3 years ago

0.0.157

3 years ago

0.0.156

3 years ago

0.0.155

3 years ago

0.0.154

3 years ago

0.0.169

3 years ago

0.0.164

3 years ago

0.0.163

3 years ago

0.0.162

3 years ago

0.0.161

3 years ago

0.0.168

3 years ago

0.0.167

3 years ago

0.0.166

3 years ago

0.0.165

3 years ago

0.0.160

3 years ago

0.0.175

2 years ago

0.0.174

3 years ago

0.0.173

3 years ago

0.0.172

3 years ago

0.0.177

2 years ago

0.0.176

2 years ago

0.0.171

3 years ago

0.0.170

3 years ago

0.0.149

3 years ago

0.0.148

3 years ago

0.0.147

3 years ago

0.0.146

3 years ago

0.0.145

3 years ago

0.0.144

3 years ago

0.0.143

3 years ago

0.0.128

3 years ago

0.0.127

3 years ago

0.0.126

3 years ago

0.0.125

3 years ago

0.0.129

3 years ago

0.0.124

3 years ago

0.0.123

3 years ago

0.0.139

3 years ago

0.0.138

3 years ago

0.0.137

3 years ago

0.0.136

3 years ago

0.0.131

3 years ago

0.0.130

3 years ago

0.0.135

3 years ago

0.0.134

3 years ago

0.0.133

3 years ago

0.0.132

3 years ago

0.0.142

3 years ago

0.0.141

3 years ago

0.0.140

3 years ago

0.0.86

3 years ago

0.0.87

3 years ago

0.0.88

3 years ago

0.0.89

3 years ago

0.0.106

3 years ago

0.0.105

3 years ago

0.0.104

3 years ago

0.0.103

3 years ago

0.0.109

3 years ago

0.0.108

3 years ago

0.0.107

3 years ago

0.0.102

3 years ago

0.0.101

3 years ago

0.0.100

3 years ago

0.0.117

3 years ago

0.0.116

3 years ago

0.0.115

3 years ago

0.0.114

3 years ago

0.0.119

3 years ago

0.0.118

3 years ago

0.0.113

3 years ago

0.0.112

3 years ago

0.0.111

3 years ago

0.0.110

3 years ago

0.0.120

3 years ago

0.0.122

3 years ago

0.0.121

3 years ago

0.0.95

3 years ago

0.0.96

3 years ago

0.0.97

3 years ago

0.0.98

3 years ago

0.0.99

3 years ago

0.0.90

3 years ago

0.0.91

3 years ago

0.0.92

3 years ago

0.0.93

3 years ago

0.0.94

3 years ago

0.0.85

3 years ago

0.0.84

3 years ago

0.0.80

3 years ago

0.0.81

3 years ago

0.0.82

3 years ago

0.0.83

3 years ago

0.0.79

3 years ago

0.0.78

3 years ago

0.0.75

3 years ago

0.0.76

3 years ago

0.0.77

3 years ago

0.0.73

3 years ago

0.0.74

3 years ago

0.0.70

3 years ago

0.0.71

3 years ago

0.0.72

3 years ago

0.0.65

3 years ago

0.0.66

3 years ago

0.0.67

3 years ago

0.0.68

3 years ago

0.0.69

3 years ago

0.0.62

3 years ago

0.0.63

3 years ago

0.0.64

3 years ago

0.0.60

3 years ago

0.0.61

3 years ago

0.0.40

3 years ago

0.0.41

3 years ago

0.0.42

3 years ago

0.0.43

3 years ago

0.0.44

3 years ago

0.0.45

3 years ago

0.0.46

3 years ago

0.0.47

3 years ago

0.0.37

3 years ago

0.0.38

3 years ago

0.0.39

3 years ago

0.0.30

3 years ago

0.0.31

3 years ago

0.0.32

3 years ago

0.0.33

3 years ago

0.0.34

3 years ago

0.0.35

3 years ago

0.0.36

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.29

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.59

3 years ago

0.0.51

3 years ago

0.0.52

3 years ago

0.0.53

3 years ago

0.0.54

3 years ago

0.0.55

3 years ago

0.0.56

3 years ago

0.0.57

3 years ago

0.0.58

3 years ago

0.0.50

3 years ago

0.0.48

3 years ago

0.0.49

3 years ago

0.0.20

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.5

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago