내용으로 건너뛰기

How to set Lambda function name?

0

I am developing Lambda (NET6) and use VS2022 Publish to AWS. It works but one question: When I see the Lambda functions list in AWS then I see long name (auto-generated) instead of my Lambda name "function-name" : "xx2aws" By the way: the description is applied.

Here is my file aws-lambda-tools-defaults.json

{ "profile" : "aws-admin", "region" : "eu-west-2", "configuration" : "Release", "s3-prefix" : "XX2AWS/", "template" : "serverless.template", "template-parameters" : "", "s3-bucket" : "bucketxx2aws", "stack-name" : "xx2awscustomers", ** "function-name" : "xx2aws",** "function-description" : "xx2aws beta" }

I cannot rename the Lambda after it is published. How this name can be assigned yo Lambda ?

질문됨 3년 전1.8천회 조회

6개 답변
1

Function name can be assigned at the time of creation, for example if you are creating a Lambda function using cloud formation, the you can use FunctionName: <name>. If you don't specify a name, AWS CloudFormation generates one. So after an auto generated name has been assigned, then the closest thing you can do is assign Alias. Please follow the documentation shared below to create an alias. https://docs.aws.amazon.com/lambda/latest/dg/configuration-aliases.html

AWS

답변함 3년 전

1
전문가

답변함 3년 전

0
수락된 답변

Need to use serverless.template file, instead of the aws-lambda-tools-defaults.json file.

"Type": "AWS::Serverless::Function", "Properties": { "FunctionName": "xx2aws", ... } ...

This way it works. But it is not clear what is the function name in the aws-lambda-tools-defaults.json, why we need it.

답변함 3년 전

0

The documentation here says to enter the function name when deploying the Lambda function, but this procedure does not set the function name?
I apologize if I am mistaken, but is deploying done differently than the procedure in the following document?
https://docs.aws.amazon.com/toolkit-for-visual-studio/latest/user-guide/lambda-creating-project-in-visual-studio.html#publish-to-lam

전문가

답변함 3년 전

0

What is incorrect in my file? VS2022 publish Lambda to AWS successfully, The question how to set name,

답변함 3년 전

0

Your file looks correct, check if the Function Name is populating on the publish screen while you are Uploading Lambda to AWS. If you do not see the name in Function Name field then try to re create your json file using the following reference. https://github.com/iammukeshm/aws-lambda-dotnet-6/blob/master/HelloLambda/aws-lambda-tools-defaults.json

AWS

답변함 3년 전

로그인하지 않았습니다. 로그인해야 답변을 게시할 수 있습니다.

좋은 답변은 질문에 명확하게 답하고 건설적인 피드백을 제공하며 질문자의 전문적인 성장을 장려합니다.

관련 콘텐츠