diff --git a/dotcom-rendering/cdk/bin/cdk.ts b/dotcom-rendering/cdk/bin/cdk.ts index 9bc82cd7a17..51db54f2ddb 100644 --- a/dotcom-rendering/cdk/bin/cdk.ts +++ b/dotcom-rendering/cdk/bin/cdk.ts @@ -124,6 +124,12 @@ export const TagPageRenderingPropsCODE: RenderingCDKStackProps = { scaleOutCooldown: Duration.seconds(60), }, }, + + // Route all traffic to ECS + targetGroupWeights: { + ec2: 0, + ecs: 1, + }, }, }; @@ -178,6 +184,12 @@ export const TagPageRenderingPropsPROD: RenderingCDKStackProps = { scaleOutCooldown: Duration.seconds(60), }, }, + + // Route 90% traffic to EC2, 10% to ECS + targetGroupWeights: { + ec2: 9, + ecs: 1, + }, }, }; diff --git a/dotcom-rendering/cdk/lib/__snapshots__/renderingStack.test.ts.snap b/dotcom-rendering/cdk/lib/__snapshots__/renderingStack.test.ts.snap index 12a9eecac0c..b4886f48dcb 100644 --- a/dotcom-rendering/cdk/lib/__snapshots__/renderingStack.test.ts.snap +++ b/dotcom-rendering/cdk/lib/__snapshots__/renderingStack.test.ts.snap @@ -2966,13 +2966,13 @@ exports[`The RenderingCDKStack matches the snapshot for Tag Page Rendering CODE "TargetGroupArn": { "Ref": "TargetGroupTagpagerendering42E428EE", }, - "Weight": 1, + "Weight": 0, }, { "TargetGroupArn": { "Ref": "TagpagerenderingEcsTargetGroupTagpagerendering0976D2E5", }, - "Weight": 0, + "Weight": 1, }, ], }, @@ -5459,13 +5459,13 @@ exports[`The RenderingCDKStack matches the snapshot for Tag Page Rendering PROD "TargetGroupArn": { "Ref": "TargetGroupTagpagerendering42E428EE", }, - "Weight": 1, + "Weight": 9, }, { "TargetGroupArn": { "Ref": "TagpagerenderingEcsTargetGroupTagpagerendering0976D2E5", }, - "Weight": 0, + "Weight": 1, }, ], }, diff --git a/dotcom-rendering/cdk/lib/renderingStack.ts b/dotcom-rendering/cdk/lib/renderingStack.ts index 2acd6f517ca..596d184c6f6 100644 --- a/dotcom-rendering/cdk/lib/renderingStack.ts +++ b/dotcom-rendering/cdk/lib/renderingStack.ts @@ -72,6 +72,10 @@ export interface RenderingCDKStackProps extends Omit { scaling: NonNullable< GuLoadBalancedAppExperimentalProps['ecsProps'] >['scaling']; + + targetGroupWeights: NonNullable< + GuLoadBalancedAppExperimentalProps['targetGroupWeights'] + >; }; } @@ -303,12 +307,7 @@ export class RenderingCDKStack extends CDKStack { cpu: ecsProps.taskCpu, scaling: ecsProps.scaling, }, - - // Route all traffic to EC2 - targetGroupWeights: { - ec2: 1, - ecs: 0, - }, + targetGroupWeights: ecsProps.targetGroupWeights, }), });