Skip to content

Commit

Permalink
Set ASG creation policy
Browse files Browse the repository at this point in the history
  • Loading branch information
akash1810 committed Jul 15, 2024
1 parent b63eaf3 commit 00634fd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
8 changes: 8 additions & 0 deletions cdk/lib/__snapshots__/cdk-playground.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ Object {
},
"Resources": Object {
"AutoScalingGroupCdkplaygroundASGD6E49F0F": Object {
"CreationPolicy": Object {
"AutoScalingCreationPolicy": Object {
"MinSuccessfulInstancesPercent": 100,
},
},
"Properties": Object {
"HealthCheckGracePeriod": 120,
"HealthCheckType": "ELB",
Expand Down Expand Up @@ -192,6 +197,9 @@ Object {
"AutoScalingReplacingUpdate": Object {
"WillReplace": true,
},
"AutoScalingScheduledAction": Object {
"IgnoreUnmodifiedGroupSizeProperties": true,
},
},
},
"CertificateCdkplayground47FCF7D9": Object {
Expand Down
13 changes: 7 additions & 6 deletions cdk/lib/cdk-playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { GuFastlyLogsIamRole } from '@guardian/cdk/lib/constructs/iam';
import type {
App,
CfnAutoScalingReplacingUpdate,

Check warning on line 10 in cdk/lib/cdk-playground.ts

View workflow job for this annotation

GitHub Actions / CI

'CfnAutoScalingReplacingUpdate' is defined but never used
CfnCreationPolicy,
CfnStack,

Check warning on line 12 in cdk/lib/cdk-playground.ts

View workflow job for this annotation

GitHub Actions / CI

'CfnStack' is defined but never used
CfnUpdatePolicy,

Check warning on line 13 in cdk/lib/cdk-playground.ts

View workflow job for this annotation

GitHub Actions / CI

'CfnUpdatePolicy' is defined but never used
} from 'aws-cdk-lib';
Expand Down Expand Up @@ -64,14 +65,14 @@ export class CdkPlayground extends GuStack {
updatePolicy: UpdatePolicy.replacingUpdate(),
});

const updatePolicy: CfnUpdatePolicy = {
autoScalingReplacingUpdate: {
willReplace: true,
} as CfnAutoScalingReplacingUpdate,
const createPolicy: CfnCreationPolicy = {
autoScalingCreationPolicy: {
minSuccessfulInstancesPercent: 100,
},
};

const asg = autoScalingGroup.node.defaultChild as CfnAutoScalingGroup;
// asg.desiredCapacity = '3';
asg.cfnOptions.updatePolicy = updatePolicy;
asg.cfnOptions.creationPolicy = createPolicy;

new GuCname(this, 'EC2AppDNS', {
app: ec2App,
Expand Down

0 comments on commit 00634fd

Please sign in to comment.