Upload receipts

The app we built works fine. It's secure and scalable. But our customers need to enter their expenses manually, which makes our app boring.

To improve user experience, we want to add allow our customers to upload photos of the receipts, and then to process them and extract amounts automatically, similar to the following diagram.

When a customer upload a receipt photo, we want to save it to Amazon S3 bucket for archiving purposes, and to use optical character recognition (OCR) to read the amount from the receipt. Then we can save the amount to our database, and keep the same backend, but improve our UX.

We'll split this task in two parts, and start with uploading a photo.

Task

Your task is to create an endpoint where customers will be able to upload photos of expense receipts, and then to store these photos to Amazon S3 bucket. To do that you'll need the following steps:

  1. Create an Amazon S3 bucket.
  2. Create an endpoint for image upload.
  3. Write a Lambda function that will receive an uploaded file and save it to the bucket you created.
  4. Add a permission for Lambda function to save the file to the bucket you created.

Once you complete this exercise, take a minute and discuss the limitations of your solution with your team. Here are a few questions you can try to answer:

  • Is this solution scalable?
  • What's the size limit for the photos?
  • Is there a duration limit on API Gateway and AWS Lambda?

Hints

Here are a few hints to help you with this task:

  1. You can create an S3 bucket using the AWS CloudFormation's AWS::S3::Bucket policy, as explained here.
  2. Bucket names must be unique globally, you should let CloudFormation name your bucket to avoid conflicts.
  3. Make sure your Lambda function has a policy that allows it to write to Amazon S3 bucket you created. You can write the policy manually, or you can use one of AWS SAM's policy templates.

results matching ""

    No results matching ""