Skip to content

Task 5. Integration with S3 #27

@Guria

Description

@Guria

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions