How to build/push and run lambda application to ecr ?

0

I am building a fast api application and containerzing it via Docker ( sample docker file below) . i want to build this image and push it to ecr and point lambda to this image . I'm planning to create lambda, api gateway resources via terraform, which seems straight forward, but to deploy, what would be the best way to build this image and push it to ecr before i create resources like lambda ? I guess it can be part of my CI/CD , build image in github/gitlab ci cd and push it to ecr , as my build process ?

are there any examples/bestpractices or blogs which cover this?

Dockerfile

FROM python:3.10-slim

WORKDIR /app

COPY requirements.txt .

RUN pip install -r requirements.txt

COPY . .

EXPOSE 8080

CMD ["uvicorn", "fastapi:app", "--host", "0.0.0.0", "--port", "8080"]
1개 답변
0

Hi

You can use multiple ways to do this here are the alternatives you can consider choose the best for your approach.

Build and Push:

  • You can use Gitlab or Github to Build and push to AWS or
  • Consider using AWS Codepipeline with Multiple stages with Source as Github/Gitlab/Codecommit Build With Codebuild and Codedeploy for ECS or EKS

Official Blogs: https://aws.amazon.com/blogs/devops/build-a-continuous-delivery-pipeline-for-your-container-images-with-amazon-ecr-as-source/

https://aws.amazon.com/blogs/devops/integrating-with-github-actions-ci-cd-pipeline-to-deploy-a-web-app-to-amazon-ec2/

profile picture
전문가
GK
답변함 한 달 전
profile picture
전문가
검토됨 한 달 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

질문 답변하기에 대한 가이드라인

관련 콘텐츠