I have created this lambda function:
exports.lambdaHandler = async event => {
const body =
message: "Hello"
};
return {
statusCode: 200,
headers: {
"Content-Type": "application/json"
},
body: JSON.stringify(body)
};
};
I have created a Docker image with this Dockerfile:
FROM amazon/aws-lambda-nodejs:12
COPY app.js package*.json ./
RUN npm install
CMD [ "app.lambdaHandler" ]
and I have pushed it to ECR. Now, I want to create a lambda function that runs it.
I have tried with this command:
aws lambda create-function --function-name greeting --role arn:aws:iam::xxxxxxxxxxxx:role/my-role --code ImageUri=xxxxxxxxxxxx.dkr.ecr.eu-central-1.amazonaws.com/greeting:latest
and I get this error:
An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: Runtime and Handler are mandatory parameters for functions created with deployment packages.
It makes no sense because it's a Docker image based lambda function so that parameters shouldn't be needed.