Skip to content

Commit

Permalink
allow tasks to use private subnets if specified
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Park committed May 8, 2024
1 parent c0d4867 commit e0a8f62
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
5 changes: 5 additions & 0 deletions packages/prerender-fargate/lib/prerender-fargate-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,11 @@ export interface PrerenderFargateOptions {
* @default - true
*/
enablePrerenderHeader?: boolean;
/**
* Locate tasks in a private subnet with egress access instead of a public subnet
* @default - false
*/
usePrivateSubnets?: boolean;
}

/**
Expand Down
6 changes: 6 additions & 0 deletions packages/prerender-fargate/lib/prerender-fargate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ export class PrerenderFargate extends Construct {
prerenderFargateRecachingOptions,
enableRecache,
enablePrerenderHeader,
usePrivateSubnets,
} = props;

// Create bucket for prerender storage
Expand Down Expand Up @@ -183,6 +184,11 @@ export class PrerenderFargate extends Construct {
prerenderFargateScalingOptions?.minHealthyPercent || 50,
maxHealthyPercent:
prerenderFargateScalingOptions?.maxHealthyPercent || 200,
taskSubnets: {
subnetType: usePrivateSubnets
? ec2.SubnetType.PRIVATE_WITH_EGRESS
: ec2.SubnetType.PUBLIC,
},
}
);

Expand Down
2 changes: 1 addition & 1 deletion packages/prerender-fargate/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aligent/cdk-prerender-fargate",
"version": "2.3.4",
"version": "2.3.5",
"description": "A construct to host Prerender in Fargate",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit e0a8f62

Please sign in to comment.