Picci
Picci

Reputation: 17762

Deploy the same function to different endpoint on ASW Lambda

I have a function which I successfully deploy to AWS Lambda using the Serverless framework.

This function relies on some environment variables which I set in the serverless.yml file like this

    provider:
        name: aws
        runtime: nodejs8.10
        stage: ${opt:stage,'dev'}
        region: ${opt:region,'eu-west-1'}
        deploymentBucket:
            name: my-bucket
        environment:
            MY_ENV_VAR: 'the value of my var'

functions:
    myFunction:
        handler: handler.myHandler
        events:
            - http:
                  path: executeFunction
                  method: post

Now I want to deploy the same logic, just with a different value of MY_ENV_VAR to a different endpoint. If I change simply the value of MY_ENV_VAR and then deploy, the endpoint does not change. But even if I change the deploymentBucket and the name of the function, i.e. myFunction, the deployment generates always the same endpoint.

Is it possible to deploy the same function to a different endpoint?

Upvotes: 0

Views: 214

Answers (1)

Picci
Picci

Reputation: 17762

Well, after a while I figure out the solution.

The first parameter of the serverless.yml file is service: myService.

Changing that parameter actually generates a deployment which creates different endpoint.

Upvotes: 0

Related Questions