Skip to content

Commit 04bd338

Browse files
committed
Amend lambda-elastic-ip-no-nat-gateway-cdk
1 parent b11e7c6 commit 04bd338

2 files changed

Lines changed: 12 additions & 30 deletions

File tree

lambda-elastic-ip-no-nat-gateway-cdk/README.md

Lines changed: 11 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1-
# Lambda Elastic IP without NAT Gateway
1+
# AWS Lambda Elastic IP without NAT Gateway
22

33
This project contains a sample AWS Cloud Development Kit (AWS CDK) template for deploying a Lambda function with a public elastic IP that has internet access without the need to provision a NAT gateway.
44

5+
## Architecture
56
![Architecture](assets/Lambda-elastic-ip-no-nat-gateway.svg)
6-
7+
## Production Architecture
78
![Production Architecture](assets/Lambda-elastic-ip-with-nat.svg)
8-
9+
## Non-prod cost effective Architecture
910
![Non-prod cost effective Architecture](assets/Lambda-elastic-ip-with-x-nat-gateway.svg)
1011

1112

@@ -35,26 +36,9 @@ Important: This application uses various AWS services and there are costs associ
3536
npm install
3637
cd src
3738
npm install
39+
cd ..
3840
```
3941

40-
```typescript
41-
#!/usr/bin/env node
42-
const app = new cdk.App();
43-
.
44-
.
45-
.
46-
47-
const patternStack = new LambdaElasticIpStack(app, 'LambdaElasticIpStack', {
48-
env: {
49-
region: process.env.CDK_DEFAULT_REGION,
50-
account: process.env.CDK_DEFAULT_ACCOUNT,
51-
},
52-
});
53-
54-
app.synth();
55-
56-
```
57-
5842
4. From the command line, configure AWS CDK:
5943
```bash
6044
cdk bootstrap ACCOUNT-NUMBER/REGION # e.g.
@@ -65,15 +49,15 @@ app.synth();
6549
```bash
6650
cdk deploy
6751
```
68-
6. Note: The AWS CDK deployment process will output the DynamoDB table name, the API endpoint, and the IoT Core Topic name used for testing this project
69-
7052

7153
## Use Case
72-
You have a lambda function that requires internet access to make api calls to 3rd party vendors but you need a dedicated IP to be whitelisted by the 3rd party vendors.
54+
You have a Lambda function that requires internet access to make API calls to 3rd party service but you need a dedicated IP to be whitelisted by the 3rd party vendors.
55+
7356
## How it works
7457

75-
This pattern allows you to assign your lambda function a static public IP address that you can use to interact with APIs that require whitelisted IPs without the need to provision a NAT Gateway. Therefore, this pattern will save almost **$33/month** in NAT Gateway costs.
58+
This pattern allows you to assign your Lambda function a static public IP address that you can use to interact with APIs that require whitelisted IPs without the need to provision a NAT Gateway. Therefore, this pattern will save almost **$33/month** in NAT Gateway costs.
7659

60+
##### **NOTE:** This pattern is best suited for non-production environments since it is not multi-AZ nor highly scalable.
7761

7862
The following resources will be provisioned:
7963

@@ -83,19 +67,16 @@ The following resources will be provisioned:
8367

8468
Since AWS manages the provisioning of any Lambda ENI, we cannot access that ENI in CDK code. Therefore, to automate the process, we have to associate the Elastic IP with the ENI in a custom resource after the deployment occurs and the ENI is provisioned.
8569

86-
##### **NOTE:** This pattern is best suited for non-production environments since it is not multi-AZ nor highly scalable.
87-
8870
## Testing
8971

90-
To test this pattern, you must use both the AWS Console and the AWS CLI.
72+
To test this pattern, use the AWS Console or the AWS CLI.
9173

9274
### AWS Console Part
9375

9476
1. Open the AWS Lambda Console
9577
2. Navigate to `vin-api-lambda`
9678
3. Test the lambda with any payload
97-
4. The lambda shouldn't time out and a random vin should be returned and logged.
98-
79+
4. The Lambda function shouldn't time out and a random vin should be returned and logged.
9980

10081
## Cleanup
10182

lambda-elastic-ip-no-nat-gateway-cdk/cdk/lib/cdk-stack.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ export class LambdaElasticIpStack extends cdk.Stack {
3535
const publicFunction = new cdk.aws_lambda_nodejs.NodejsFunction(this, 'Lambda-With-Elastic-IP', {
3636
memorySize: 128,
3737
handler: 'handler',
38+
functionName: 'vin-api-lambda',
3839
timeout: cdk.Duration.seconds(10),
3940
bundling: {
4041
minify: true,

0 commit comments

Comments
 (0)