Closed krymtkts closed 2 years ago
Similar to repro in https://github.com/aws/aws-tools-for-powershell/issues/202
Reproduction Steps:
dotnet new lambda.image.EmptyFunction
.Dockerfile
to below:FROM public.ecr.aws/lambda/dotnet:5.0 as base
FROM mcr.microsoft.com/dotnet/sdk:5.0-buster-slim as build
COPY . /TestFunction
WORKDIR /TestFunction
RUN dotnet build "TestFunction.csproj" --configuration Release --output /app/build
FROM build AS publish
RUN dotnet publish "TestFunction.csproj" \\
--configuration Release \\
--runtime linux-x64 \\
--self-contained false \\
--output /app/publish \\
-p:PublishReadyToRun=true
FROM base AS final
WORKDIR /var/task
COPY --from=publish /app/publish .
Executed docker build -t testlambdadotnet .
to build docker image.
In AWS Console, created an ECR repository. Then clicked on View Push Commands and executed following commands one by one:
-- aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 139480602983.dkr.ecr.us-east-2.amazonaws.com
-- docker build -t testlambdadotnet .
-- docker tag testlambdadotnet:latest 139480602983.dkr.ecr.us-east-2.amazonaws.com/testlambdadotnet:latest
-- docker push 139480602983.dkr.ecr.us-east-2.amazonaws.com/testlambdadotnet:latest
Created new IAM role arn:aws:iam::139480602983:role/testlambdaexecute-role with AWSLambdaBasicExecutionRole
policy.
Executed AWS CLI command to create Lambda function:
aws lambda create-function \
--role arn:aws:iam::139480602983:role/testlambdaexecute-role \
--function-name lambda-docker-dotnet \
--package-type Image \
--code ImageUri=139480602983.dkr.ecr.us-east-2.amazonaws.com/testlambdadotnet:latest
Executing aws lambda update-function-code --function-name "lambda-docker-dotnet" --image-uri 139480602983.dkr.ecr.us-east-2.amazonaws.com/testlambdadotnet:latest
works fine.
However, executing Update-LMFunctionCode -FunctionName lambda-docker-dotnet -ImageUri 139480602983.dkr.ecr.us-east-2.amazonaws.com/testlambdadotnet:latest
prompts for ZIP file parameter. This is an issue.
Any movement on this? It's affecting me. Due to ML models being so large we must use docker images to use lambda functions.
I'm also affected.
This should be fixed in AWS.Tools.Lambda 4.1.18.0
Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.
Description
Update-LMFunctionCode
cannot update the image URI of Lambda function because this function has a default parameter set named'FromMemoryStream'
andImageUri
option doesn't have a parameter set name.https://github.com/aws/aws-tools-for-powershell/blob/0b04f48e74c70d7468c7d3582179d38e53708bca/modules/AWSPowerShell/Cmdlets/Lambda/Basic/Update-LMFunctionCode-Cmdlet.cs#L45
https://github.com/aws/aws-tools-for-powershell/blob/0b04f48e74c70d7468c7d3582179d38e53708bca/modules/AWSPowerShell/Cmdlets/Lambda/Basic/Update-LMFunctionCode-Cmdlet.cs#L75-L83
So we cannot update image URI using the
ImageUri
option. It is blocked by unnecessary mandatory parameterZipFile
. Of course theImageUri
option cannot use withZipFile
option.aws cli v2 works well in the same case.
Reproduction Steps
Logs
none.
Environment
Resolution
This is a :bug: bug-report