This project demonstrates how to securely authenticate with AWS IAM, analyze an image using AWS Rekognition, and extract meaningful labels such as objects and categories .
- π Securely input AWS credentials using
getpass(hidden input). - β Validate IAM session with AWS STS to confirm authorized access.
- πΌοΈ Load an image from a direct URL.
- π Convert the image into byte format for Rekognition.
- π§ Analyze the image using AWS Rekognition's Label Detection API.
- π Extract and print the top labels with confidence scores.
- AWS account with Rekognition enabled.
- IAM user with permissions to use Rekognition and STS.
- Your Access Key ID and Secret Access Key.
- A direct URL to an image (must return an image file, not a webpage).
Install boto3 in your Colab notebook:
%pip install boto3- The image URL must be direct to an image file, not a webpage or redirect.
- Rekognition supports images via:
- Raw bytes (as shown).
- Images stored in S3 (using
'S3Object': {Bucket, Name}).
- Avoid hardcoding AWS credentials; always use secure input methods.
- Use least privilege IAM policies for security.
- AWS Rekognition costs apply beyond free tier limits. Monitor usage accordingly.