Can't create Lambda function using container runtime
See original GitHub issueDescribe the bug I’m trying to create a lambda function using a container image runtime. It fails with the error:
botocore.errorfactory.InvalidParameterValueException: An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: Runtime and Handler are mandatory parameters for functions created with deployment packages.
When I put Runtime and Handler parameters, it fails again with error:
botocore.errorfactory.InvalidParameterValueException: An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: Please provide a source for function code.
I don’t see why do I have to put Runtime and Handler parameters with a container runtime, when those parameters are managed by the container itself. In the AWS console, you only need to specify the image URI. What am I doing wrong?
Steps to reproduce
import boto3
aws_session = boto3.Session()
lambda_client = aws_session.client('lambda', region_name='us-east-1')
image_uri = '1234567890.dkr.ecr.us-east-1.amazonaws.com/lambda-container:latest'
response = lambda_client.create_function(
FunctionName='container_test',
Role='arn:aws:iam::1234567890:role/lambda-role',
Code={
'ImageUri': image_uri
},
Timeout=600,
MemorySize=1024
)
Expected behavior Create lambda function as container runtime with the URI image specified.
Debug logs https://gist.github.com/aitorarjona/3e41603abd271736a3e1a28b505f0b07
Issue Analytics
- State:
- Created 3 years ago
- Comments:5
Top Results From Across the Web
Creating Lambda container images - AWS Documentation
Create a container image for a Lambda function by using an AWS provided base image or an alternative base image.
Read more >Deploying Lambda functions as container images
Creating the function · Open the Functions page of the Lambda console. · Choose Create function. · Choose the Container image option. ·...
Read more >Using container images with AWS Lambda | by Michael Hart
I've shown how you can use existing docker tooling to create and test your container images locally — including a full integration test...
Read more >Package your Lambda function as a container image - Lumigo
You can't run long-running services in Lambda, your code is still bound by Lambda's invocation model (i.e., it only runs when the function...
Read more >AWS Lambda with custom docker images as runtime
Learn how to build and deploy an AWS Lambda function with a custom python docker container as runtime with the use of Amazon...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vlall Here there is an example: https://github.com/lithops-cloud/lithops/blob/4aa42395fa7d9cf75eba708bd16064c094e71af2/lithops/serverless/backends/aws_lambda/aws_lambda.py#L330
@aitorarjona hi, I’m author of lua-aws and encountered same problem. in my case, problem is missing parameter. in brief, PayloadType = “Image” is required like this.
hope this helps you 👍