Test Lambda function operation

  1. Navigate to S3 bucket: book-image-store
  • Click Upload

S3Bucket

  1. Click Add files

S3Bucket

  1. Select image to upload, then click Upload

S3Bucket

  1. Wait for the image to be uploaded successfully, then click Close

S3Bucket

  1. Wait for the Lambda function running, then check if the image has been deleted or not

S3Bucket

  1. Navigate to other bucket - book-image-resize-store
  • Click to image file

S3Bucket

  1. Click Object URL to download image

S3Bucket

  1. But error occurs - Access Denied.

S3Bucket

  1. To download image, need add policy for bucket to allow public access.
  • Back to bucket, select Permission
  • Click Edit in Bucket policy

S3Bucket

  • Copy the below json data into Policy
{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "PublicReadGetObject",
            "Effect": "Allow",
            "Principal": "*",
            "Action": "s3:GetObject",
            "Resource": "arn:aws:s3:::book-image-resize-store/*"
        }
    ]
}
  • Click Save changes

S3Bucket

  1. Then, repeat steps 6 and 7 to download image to local to download an image to your device to compare it with the one you’ve already uploaded. So Lambda resizes function is working properly.