Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS SAM - How to specify the name of your function

I'm trying the Create Your Own Serverless Application and I see that the name of the function is specified in the YAML template but when it gets deployed it creates a lambda with a composite name based on:

CloudFormation stack + Lambda function + Some Id.

My questions is: Is there a way to override the name of the function when using AWS SAM?

Thanks

like image 714
Orposuser Avatar asked Mar 26 '17 15:03

Orposuser


1 Answers

Yes there is, take a look at https://github.com/awslabs/serverless-application-model/blob/master/versions/2016-10-31.md#awsserverlessfunction

You need the FunctionName parameter in your YAML.

Similar to the following:

AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Resources:
    samPocFunction:
        Type: AWS::Serverless::Function
        Properties:
            FunctionName: samPoc
            Description: This is my SAM POC function
            Runtime: python2.7
            CodeUri: ./functions/mycode
            Handler: handler.handler
            MemorySize: 128
            Timeout: 3
like image 120
alanwill Avatar answered Sep 18 '22 18:09

alanwill