Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[POC-2] Implement AWS Lambda Function for Image Grid Creation #4

Open
brunosantoslab opened this issue Jul 21, 2024 · 0 comments
Open

Comments

@brunosantoslab
Copy link
Owner

brunosantoslab commented Jul 21, 2024

Objective:
Develop and deploy an AWS Lambda function that processes images stored in an S3 bucket, creates a grid from these images, and uploads the resulting image grid back to an S3 bucket. This Lambda function will serve as a proof of concept for automated image processing using serverless architecture.

Key Tasks:

  1. Setup Environment:

    • Create and configure a new AWS Cloud9 environment.
    • Ensure AWS CLI is installed and configured with appropriate permissions.
  2. Develop Lambda Function:

    • Write a Python script (lambda_function.py) that:
      • Reads images from a specified S3 bucket.
      • Creates an image grid using the Python Imaging Library (PIL).
      • Uploads the resulting image grid to a different S3 bucket.
    • Create a requirements.txt file with necessary dependencies (e.g., boto3, Pillow).
  3. Package and Deploy Lambda Function:

    • Create a virtual environment and install dependencies.
    • Package the Lambda function and its dependencies into a zip file.
    • Use AWS CLI to create the Lambda function with the packaged zip file.
    • Set up the necessary IAM roles and policies to ensure the Lambda function can read from and write to S3, and that the deployment role can execute the required actions.
  4. Invoke and Test Lambda Function:

    • Create a test with pytest and moto.
    • Use AWS CLI to invoke the Lambda function with the test event.
    • Verify the output by checking the destination S3 bucket for the generated image grid.
  5. Document the Process:

    • Update the README.md file with detailed instructions on how to set up, deploy, and test the Lambda function.
    • Include observations about necessary IAM policies and roles.

Deliverables:

  • Python script (lambda_function.py) for the Lambda function.
  • requirements.txt file with necessary dependencies.
  • Packaged zip file for the Lambda function and its dependencies.
  • Updated README.md with setup, deployment, and testing instructions.
  • Verification of the image grid uploaded to the destination S3 bucket.

Additional Notes:

  • Ensure the IAM role used for the Lambda function has iam:PassRole and lambda:InvokeFunction permissions.
  • The proof of concept should demonstrate the feasibility of using AWS Lambda for automated image processing tasks.

This task will establish the foundation for further development and deployment of serverless image processing workflows.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: In progress
Development

When branches are created from issues, their pull requests are automatically linked.

1 participant