Test Lambda function operation
- Navigate to S3 bucket: book-image-store
- Click Add files
- Select image to upload, then click Upload
- Wait for the image to be uploaded successfully, then click Close
- Wait for the Lambda function running, then check if the image has been deleted or not
- Navigate to other bucket - book-image-resize-store
- Click Object URL to download image
- But error occurs - Access Denied.
- To download image, need add policy for bucket to allow public access.
- Back to bucket, select Permission
- Click Edit in Bucket policy
- 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/*"
}
]
}
- 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.