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

Task 5. Integration with S3 #27

Open
Guria opened this issue Oct 29, 2022 · 1 comment
Open

Task 5. Integration with S3 #27

Guria opened this issue Oct 29, 2022 · 1 comment

Comments

@Guria
Copy link
Owner

Guria commented Oct 29, 2022

Task 5 assignment

Note for reviewers

Task 5 Artifacts

Task 5.1 (Commit 924322f)

✔️ Create a new service called import-service at the same level as Product Service.
✔️ Reuse S3 bucket for fixtures for uploaded data

Task 5.2 (Pull Request #25)

✔️ Create a lambda function importProductsFile which will be triggered by the HTTP GET method.
✔️ The requested URL is /import.
✔️ Implement its logic so it will be expecting a request with a name of CSV file with products and creating a new Signed URL.
✔️ The name will be passed in a query string as a name parameter and should be described in the serverless config file as a request parameter.
✔️ Add policies to allow lambda functions to interact with S3.
✔️ The response from the lambda should be the created Signed URL.
✔️ The lambda endpoint is integrated with the frontend.

Extra notes:

  • New service reuse same existing api gateway
  • Validation error with status code 400 returned in case name wasn't provided
  • Filename suffixed with timestamp to avoid existing files overwrite

Task 5.3 (Pull Request #26)

✔️ Create a lambda function importFileParser which will be triggered by an S3 event.
✔️ The event should be s3:ObjectCreated:*
✔️ Configure the event to be fired only by changes in the uploaded folder in S3.
✔️ The lambda function use a readable stream to get an object from S3, parse it using csv-parser package and logs each record to be shown in CloudWatch.

Additional tasks:
➕ Business logic of importProductsFile lambda is covered by unit tests
➕ At the end of the stream the lambda function moves the file from the uploaded folder into the parsed folder

Links to deployment

Deployments links removed since its outdated and there are newer tasks implemented.

Cloudwatch Logs screenshot:
image

@margarita-sh
Copy link

your score is 8

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

No branches or pull requests

2 participants