Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 18 additions & 9 deletions lambda-efs-cdk/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Amazon API Gateway to Lambda to Amazon EFS
# Amazon API Gateway to AWS Lambda to Amazon EFS

This pattern attaches an EFS file system to your Lambda function to give it expandable, persistent storage. Having this level of storage in a Lambda function opens the door to many new possibilities (multiple functions can even use the same file system)

Expand Down Expand Up @@ -43,10 +43,8 @@ Important: this application uses various AWS services and there are costs associ
```bash
cdk deploy
```
1. Cleanup

1. Note the outputs from the CDK deployment process. These contain the resource names and/or ARNs which are used for testing.

Note the outputs from the CDK deployment process. These contain the resource names and/or ARNs which are used for testing.

## How it works

Expand All @@ -66,8 +64,13 @@ The Lambda Function will behave differently based on the RESTful verb you use:
The URL for the HTTP API to use these commands will be printed in the CloudFormation stack output after you deploy.
Postman can be used to read/write text using API URL printed in output of the cdk deploy command.

Note - After deployment you may need to wait 60-90 seconds before the implementation works as expected. There are a lot of network configurations happening so you need to wait on propagation
```bash
curl -X POST -H 'Content-Type: text/plain' -d 'Hello!' ${APIUrl}
curl ${APIUrl}
curl -X DELETE ${APIUrl}
```

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Add testing commands.


Note - After deployment you may need to wait 60-90 seconds before the implementation works as expected. There are a lot of network configurations happening so you need to wait on propagation

## Useful commands

Expand All @@ -77,12 +80,18 @@ Note - After deployment you may need to wait 60-90 seconds before the implementa
* `cdk diff` compare deployed stack with current state
* `cdk docs` open CDK documentation

## Cleanup

1. Run the given command to delete the resources that were created.
```bash
cdk destroy
```

## Useful References
[Using Amazon EFS with Lambda] (https://docs.aws.amazon.com/lambda/latest/dg/services-efs.html)
[[Configuring file system access for Lambda functions] https://docs.aws.amazon.com/lambda/latest/dg/configuration-filesystem.html
Using Amazon EFS for AWS Lambda in your serverless applications] (https://aws.amazon.com/blogs/compute/[using-amazon-efs-for-aws-lambda-in-your-serverless-applications/
Danilo Poccia - A Shared File System for Your Lambda Functions] https://aws.amazon.com/blogs/aws/new-a-shared-file-system-for-your-lambda-functions/)
- [Using Amazon EFS with Lambda](https://docs.aws.amazon.com/lambda/latest/dg/services-efs.html)
- [Configuring file system access for Lambda functions](https://docs.aws.amazon.com/lambda/latest/dg/configuration-filesystem.html)
- [Using Amazon EFS for AWS Lambda in your serverless applications](https://aws.amazon.com/blogs/compute/using-amazon-efs-for-aws-lambda-in-your-serverless-applications/)
- [Danilo Poccia - A Shared File System for Your Lambda Functions](https://aws.amazon.com/blogs/aws/new-a-shared-file-system-for-your-lambda-functions/)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: Fix broken markdown links.


----
Copyright 2021 Amazon.com, Inc. or its affiliates. All Rights Reserved.
Expand Down
4 changes: 2 additions & 2 deletions lambda-efs-cdk/lambda_efs_cdk/lambda_efs_cdk_stack.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@
aws_lambda as _lambda
)
from constructs import Construct
import aws_cdk.aws_apigatewayv2_alpha as api_gateway
import aws_cdk.aws_apigatewayv2_integrations_alpha as integrations
import aws_cdk.aws_apigatewayv2 as api_gateway
import aws_cdk.aws_apigatewayv2_integrations as integrations


class LambdaEfsCdkStack(Stack):
Expand Down
4 changes: 1 addition & 3 deletions lambda-efs-cdk/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,2 @@
aws-cdk-lib==2.13.0
aws-cdk-lib==2.260.0
constructs>=10.0.0,<11.0.0
aws-cdk.aws-apigatewayv2-alpha
aws-cdk.aws-apigatewayv2-integrations-alpha

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

note: The apigatewayv2-alpha modules are deprecated because they graduated to stable and are now part of aws-cdk-lib.