This guide explains how to set up a cloud-based photo album using AWS services including OpenSearch, Lambda, S3, API Gateway, and Lex.
Visit the following links for more information on setting up and managing the photo album project:
- For the S3 bucket setup, check out the repository here.
- For details on the Lambda functions setup, visit the repository here.
- If you need more detailed steps and configurations, you can find them here.
Create an OpenSearch Domain: Name it photos
.
- Create S3 Bucket: Name it
b2-imgs
. - Lambda Function for Indexing (LF1): Name it
index-photos
.- Set Up Trigger: Trigger LF1 when a photo is added to
b2-imgs
. - Function Tasks: When an image is uploaded:
- Use AWS Rekognition to detect image labels.
- Retrieve metadata from the image using S3 SDK’s headObject method.
- Create and store a JSON array of labels in OpenSearch.
- Set Up Trigger: Trigger LF1 when a photo is added to
- Permissions: Ensure LF1 and OpenSearch can interact by sharing their IAM role ARNs.
- Lambda Function for Searching (LF2): Name it
search-photos
. - Set Up a Lex Bot: Name it
search-bot
for handling search queries.- Intents: Create intents to capture one or two keywords from user queries for searching photos.
- Permissions: Same as step 2, ensure LF2 and OpenSearch can interact.
- Create a REST API: Import settings from a Swagger or Open API file.
- Configure Methods:
- PUT: For uploading images to S3.
- GET: For retrieving data from OpenSearch to display results.
- Deploy API: Create a new stage and generate an SDK for frontend integration.
- Web Pages:
- Index.html: Main landing page.
- Gallery.html: Search gallery using keywords.
- Upload.html: Upload new images to the gallery.
- Deploy on S3: Upload these files to an S3 bucket named
photo-gallery-fe
and set it to allow public access.
aws
lambda
s3
api-gateway
rekognition
lex
opensearch