Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
315 views
in Technique[技术] by (71.8m points)

amazon web services - Unable to access ecr repository in my registry when deploying aws lambda function

Problem Statement:

I am trying to use a built docker container image and use that as the source for an AWS lambda function. However, whenever I build the lambda function and deploy it, I am getting this error every time.

The repository with name 'xxxxxxxxx' does not exist in the registry 
with id '########'.

I did some sanity checks to make sure that my serverless.yml file was created correctly, with the correct spelling, and that this repository actually exists in ECR.

serverless.yml
provider:
  name: aws
  runtime: python3.8
  stage: ${env:BRANCH_NAME}
  region: us-west-2
  role: arn:aws:iam::#########:role/current-role
  vpc:
    securityGroupIds:
      - ${env:SG_ID}
    subnetIds:
      - ${env:SUBNET_ID}
  tracing:
    lambda: true
  environment:
    REGION_NAME: us-west-1
    PYTHONPATH: '/var/task/packages:/var/runtime'
    S5_QUEUE_URL: ${env:S5_QUEUE_URL}
    SECRET_NAME: ${env:SECRET_NAME}
  iamRoleStatements:
    - Effect: Allow
      Action:
        - 'ecr:SetRepositoryPolicy'
        - 'ecr:GetRepositoryPolicy'
      Resource: 'arn:aws:ecr:us-west-2:########:xxxxxxxxx/directory/'
functions:
  function1:
    image: '#######.dkr.ecr.us-west-2.amazonaws.com/xxxxxxxxx/directory:tag'
  

However, for some reason, I still am unable to access this repository, no matter what changes I have made it to my serverless.yml file. At first, I assumed, this might be a permissions issue, but I don't see any problem with my permissions declared...Can someone help?

question from:https://stackoverflow.com/questions/66052001/unable-to-access-ecr-repository-in-my-registry-when-deploying-aws-lambda-functio

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Change the runtime from python3.8 to provided, see Custom runtimes with the Serverless Framework


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...