"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

February 03, 2023

AWS Lambda - Docker - Building Models

Sometimes outdated blogs do not get results but to know something from high-level to ground level need to try it end to end.

Sharing some lessons in building example link

On the Mac system installed docker, and python already.

Lesson #1 - Creating empty files in mac

  • file creation - touch requirements.txt
  • touch app.py copy code
  • touch Dockerfile, copy script
Lesson #2 - Installing Amazon CLI
  • CLI Install - Steps mentioned in link
  • For Mac - Download from link

Post Installation Validation commands

$ which aws
/usr/local/bin/aws 
$ aws --version
aws-cli/2.7.24 Python/3.8.8 Darwin/18.7.0 botocore/2.4.5

Lesson #3 - User Creation

Under IAM create users - https://us-east-1.console.aws.amazon.com/iamv2/home#/users
Create user, For the user create key, You will have access id, access key

Configure your AWS CLI with command

aws configure

Lesson #4 - Amazon ECR Creation and push image

aws ecr get-login-password --region us-west-2 | docker login --username AWS --password-stdin 261091142.dkr.ecr.us-west-2.amazonaws.com

docker build -t demo .

docker tag demo:latest 261091142.dkr.ecr.us-west-2.amazonaws.com/demo:latest

docker push 261091142.dkr.ecr.us-west-2.amazonaws.com/demo:latest

Lesson #5 - Create Lambda function from the Image




Lesson #6 - Give AWS S3 Read access for the user to read the input




It is not rocket science but some debug science is needed. You know what to do but finding the flows in UI takes time

The image did not compile some errors. This is an outdated blog. 

AWS CLI, Dockerizing, ECR, Lambda + S3. It was a good end-to-end flow.

Keep Exploring!!!

No comments: