Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New pattern: Upload files to S3 bucket using presigned URLs (terraform) #2475

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

pjx98
Copy link
Contributor

@pjx98 pjx98 commented Sep 18, 2024

Issue #, if available:

Description of changes:
This sample project deploys an Amazon API Gateway REST API with an AWS Lambda integration. The Lambda function, written in Java, generates a presigned URL with write access to an Amazon S3 Bucket. The provided test class uploads a file into the S3 bucket using the presigned URL.

This project is implemented using Terraform and references the below pattern which is implemented using AWS SAM:
https://github.com/aws-samples/serverless-patterns/tree/main/apigw-lambda-s3-sam-java

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@@ -0,0 +1,107 @@
# Upload file up to 5GB to Amazon S3 bucket using presigned URL using Terraform
Copy link
Contributor

Choose a reason for hiding this comment

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

I understand the intention but I suggest moving the 5 GB limitation to the paragraph below instead of the title

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Got it. I have moved the 5GB limitation to the paragraph below!


## How it works

This Terraform project uses allows user to upload a file up to 5 GB size using Amazon S3 bucket pre-sienged URL. Please refer to the architecture diagram below:
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
This Terraform project uses allows user to upload a file up to 5 GB size using Amazon S3 bucket pre-sienged URL. Please refer to the architecture diagram below:
This Terraform project uses allows user to upload a file up to 5 GB size using Amazon S3 bucket presigned URL. Please refer to the architecture diagram below:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed all pre-seigned wordings to presigned

"name": "Jing Xiang Peh",
"image": "images/profile-pic.jpg",
"bio": "I am a specialist solutions architect, Serveless based in Singapore",
"linkedin": "https://www.linkedin.com/in/jing-xiang-peh/"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"linkedin": "https://www.linkedin.com/in/jing-xiang-peh/"
"linkedin": "jing-xiang-peh"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed as well

{
"name": "Jing Xiang Peh",
"image": "images/profile-pic.jpg",
"bio": "I am a specialist solutions architect, Serveless based in Singapore",
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"bio": "I am a specialist solutions architect, Serveless based in Singapore",
"bio": "I am a Specialist Solutions Architect for Serveless based in Singapore",

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed as well

"text": [
"Amazon API Gateway receives the HTTP POST request containing the file name to be uploaded",
"AWS Lambda is triggered by the API Gateway, this java based function generates Amazon S3 presigned URL.",
"A Java program is used to upload a file to the Amazon S3 bucket using the pre-signed URL"
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
"A Java program is used to upload a file to the Amazon S3 bucket using the pre-signed URL"
"A Java program is used to upload a file to the Amazon S3 bucket using the presigned URL"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed as well

<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>3.11.3</version>
Copy link
Contributor

Choose a reason for hiding this comment

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

See above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to latest version

<dependency>
<groupId>software.amazon.awssdk</groupId>
<artifactId>aws-core</artifactId>
<version>2.21.19</version>
Copy link
Contributor

Choose a reason for hiding this comment

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

this should not be necessary with the bom import above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

removed

<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20231013</version>
Copy link
Contributor

Choose a reason for hiding this comment

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

see above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to latest version

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
Copy link
Contributor

Choose a reason for hiding this comment

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

see above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to latest version

</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<version>3.3.0</version>
Copy link
Contributor

Choose a reason for hiding this comment

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

see above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated to latest version

@pjx98
Copy link
Contributor Author

pjx98 commented Sep 30, 2024

Hello Ben, I have make the required changes and commit to the PR. Please review it and let me know if it's alright! Thank u!

@bfreiberg
Copy link
Contributor

Looks good, thank you for your contribution. Your pattern will be merged to Serverlessland.com soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants