Skip to content

Commit

Permalink
SD-1760 Lambdas making all outbound API calls through the static IP o…
Browse files Browse the repository at this point in the history
…f a VPC NAT gateway
  • Loading branch information
gj0dcsa committed Nov 17, 2024
1 parent 8d5b6bc commit 0336835
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions cdk/src/main/java/org/dcsa/conformance/cdk/ConformanceStack.java
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@
import software.amazon.awscdk.services.dynamodb.BillingMode;
import software.amazon.awscdk.services.dynamodb.Table;
import software.amazon.awscdk.services.dynamodb.TableProps;
import software.amazon.awscdk.services.ec2.SubnetSelection;
import software.amazon.awscdk.services.ec2.SubnetType;
import software.amazon.awscdk.services.ec2.Vpc;
import software.amazon.awscdk.services.iam.ManagedPolicy;
import software.amazon.awscdk.services.iam.Policy;
import software.amazon.awscdk.services.iam.PolicyProps;
Expand Down Expand Up @@ -141,6 +144,8 @@ public ConformanceStack(
.billingMode(BillingMode.PAY_PER_REQUEST)
.build());

Vpc vpc = Vpc.Builder.create(this, prefix + "ConformanceVpc").maxAzs(1).natGateways(1).build();

AssetCode assetCode =
Code.fromAsset(
"../lambda/",
Expand Down Expand Up @@ -175,6 +180,9 @@ public ConformanceStack(
.runtime(Runtime.JAVA_21)
.code(assetCode)
.handler("org.dcsa.conformance.lambda.SandboxTaskLambda")
.vpc(vpc)
.vpcSubnets(
SubnetSelection.builder().subnetType(SubnetType.PRIVATE_WITH_EGRESS).build())
.memorySize(1024)
.timeout(Duration.minutes(5))
.reservedConcurrentExecutions(16)
Expand All @@ -190,6 +198,9 @@ public ConformanceStack(
.runtime(Runtime.JAVA_21)
.code(assetCode)
.handler("org.dcsa.conformance.lambda.ApiLambda")
.vpc(vpc)
.vpcSubnets(
SubnetSelection.builder().subnetType(SubnetType.PRIVATE_WITH_EGRESS).build())
.memorySize(1024)
.timeout(Duration.minutes(5))
.reservedConcurrentExecutions(16)
Expand All @@ -205,6 +216,9 @@ public ConformanceStack(
.runtime(Runtime.JAVA_21)
.code(assetCode)
.handler("org.dcsa.conformance.lambda.WebuiLambda")
.vpc(vpc)
.vpcSubnets(
SubnetSelection.builder().subnetType(SubnetType.PRIVATE_WITH_EGRESS).build())
.memorySize(1024)
.timeout(Duration.minutes(5))
.reservedConcurrentExecutions(16)
Expand Down

0 comments on commit 0336835

Please sign in to comment.