11

I have a lambda which was created and deployed with CloudFormation. The lambda, as of now, uses the supported .NET Core 3.1 runtime but I want to use the "unsupported" .Net Core 5 so I have created a Docker image which the lambda can run.

The problem I have is that CloudFormation can't seem to change the lambda from running a supported runtime to running a Docker image. I get Please don't provide ImageUri when updating a function with packageType Zip. when updating the CloudFormation stack with the updated template.

This is how my CloudFormation template looks like:

MyFunction:
    Type: "AWS::Serverless::Function"
    Properties:
        PackageType: Image
        ImageUri: <uri-to-ecr-docker-image>
        ...
    Metadata:
        Dockerfile: Dockerfile
        DockerContext: .
        DockerTag: v1

Any ideas on how to solve this?

Junker
  • 397
  • 3
  • 13

2 Answers2

15

Configuring functions defined as container images

You cannot convert an existing .zip file archive function to use a container image. You must create a new function.

samtoddler
  • 8,463
  • 2
  • 26
  • 21
  • 1
    Thank you, completely missed that. I renamed the function in my template and then I had to add these permissions https://stackoverflow.com/a/65151634/6193522 – Junker Feb 28 '21 at 17:31
  • +1. Just to clarify what to do : you need to create new lambda function (your current is not for image-based deployments) with "Image" option, after this - should works/deploy as expected – Nigrimmist Apr 25 '22 at 22:42
0

simple way Deploy a fresh environment with a docker runtime from the start.