@@ -46,14 +46,28 @@ export interface RenderingCDKStackProps extends Omit<GuStackProps, 'stack'> {
4646 } ;
4747
4848 /**
49- * Which image to run.
50- * This should be the image digest (e.g. 'sha256:abc123') to ensure immutable deployments.
51- *
52- * @note Currently optional to control which services run in an EC2-ECS hybrid mode, or EC2-only.
53- *
54- * @see https://docs.docker.com/dhi/core-concepts/digests
49+ * ECS configuration including image identifier and instance sizing.
50+ * Optional to control which services run in an EC2-ECS hybrid mode, or EC2-only.
5551 */
56- imageIdentifier ?: string ;
52+ ecsProps ?: {
53+ /**
54+ * Which image to run.
55+ * This should be the image digest (e.g. 'sha256:abc123') to ensure immutable deployments.
56+ *
57+ * @see https://docs.docker.com/dhi/core-concepts/digests
58+ */
59+ imageIdentifier : string ;
60+
61+ /**
62+ * vCPU units for the ECS task
63+ */
64+ taskCpu : number ;
65+
66+ /**
67+ * Memory in MB for ECS task
68+ */
69+ taskMemoryLimitMiB : number ;
70+ } ;
5771}
5872
5973const addCPUStepScalingPolicy = (
@@ -200,14 +214,8 @@ export class RenderingCDKStack extends CDKStack {
200214 } ) ;
201215
202216 const { stack : guStack , region, account } = this ;
203- const {
204- guApp,
205- stage,
206- instanceType,
207- scaling,
208- domainName,
209- imageIdentifier,
210- } = props ;
217+ const { guApp, stage, instanceType, scaling, domainName, ecsProps } =
218+ props ;
211219
212220 const artifactsBucket =
213221 GuDistributionBucketParameter . getInstance ( this ) . valueAsString ;
@@ -276,17 +284,16 @@ export class RenderingCDKStack extends CDKStack {
276284 } ) ,
277285 } ,
278286
279- // Provision ECS resources only when `imageIdentifier ` has been provided
280- ...( imageIdentifier == null
287+ // Provision ECS resources only when `ecsProps ` has been provided
288+ ...( ecsProps == null
281289 ? { }
282290 : {
283291 ecsProps : {
284292 repositoryName : 'guardian/dotcom-rendering' ,
285- imageIdentifier,
293+ imageIdentifier : ecsProps . imageIdentifier ,
286294
287- // TODO tune these values
288- memoryLimitMiB : 2048 ,
289- cpu : 1024 ,
295+ memoryLimitMiB : ecsProps . taskMemoryLimitMiB ,
296+ cpu : ecsProps . taskCpu ,
290297 scaling : {
291298 minimumTasks : 1 ,
292299 maximumTasks : 2 ,
0 commit comments