Closed xavicolomer closed 7 years ago
I did the following with the serverless-aws-alias-example project.
git checkout master
npm install
serverless deploy
git checkout authorizer
npm install
serverless deploy --alias=auth
The deploy created the main and the alias stacks correctly:
Nevertheless the message emitted by Serverless does not show the actual alias endpoints but this is only a console output issue in SLS. I can try to fix that in the plugin, so that the correct URLs are shown.
endpoints:
GET - https://ai49k1bvja.execute-api.us-east-1.amazonaws.com/dev/func1
POST - https://ai49k1bvja.execute-api.us-east-1.amazonaws.com/dev/func1/update
GET - https://ai49k1bvja.execute-api.us-east-1.amazonaws.com/dev/func2
The Lambda functions are also deployed correctly, and the aliases are set to the correct versions. As an example I show the testfct1 which is available in master and authorize (resp. dev and auth aliases).
Also the APIs have been deployed correctly for each of the deployed aliases. If you have a look at the deployed stages in API Gateway, you see, that even the defined endpoints (which are different in the master and authorizer branches) are deployed correctly.
You can access the endpoints that are deployed to the different aliases with:
https://xxxxxx.execute-api.us-east-1.amazonaws.com/auth/...
https://xxxxxx.execute-api.us-east-1.amazonaws.com/dev/...
The endpoint in a specific alias will automatically call the correct aliased Lambda function version that is attached to the endpoint in your ' serverless.yml`.
Hi there,
Sorry for not answering before.
You are right, your plugin works great, the output from the deploy was misleading since I didn't saw any changes.
Thanks
This helped a lot. Thanks.
UPDATE: After looking through again, this truly is an amazing plugin.
@HyperBrain from the example you showed above:
One single AWS lambda resource called "dev-sls-test-project " with two different versions tagged with different aliases:
One API Gateway resource is created:
My question would be: Is it possible to have two separate AWS lambda resources instead of one AWS lambda resource, but still being able to share the same API Gateway by utilizing the API Gateway's "stage" feature as you did in your example?
Meaning:
An AWS lambda resource called "my-dev-project" with a "dev" alias
An AWS lambda resource called "my-auth-project" with a "auth" alias
One API Gateway resource is created:
Would this be possible?
Hi there,
Serverless version: 1.17
For some reason I am always generating the same stack no matter what Alias I put on. I followed the installation instructions and it seems the Alias plugin is giving some feedback while deploying, but its always deploying / overwriting the same content with the same endpoints
I created first the first stage deploy
serverless deploy
And then I tried to create aliases for v1
serverless deploy --alias v1
and v2
serverless deploy --alias v2
But I always end up overwriting the API Gateway, Lambdas and everything
POST - https://{same_endpoint}.execute-api.eu-west-1.amazonaws.com/...
More info
In my lambda console I only have one version of the lambdas, I would expect to have one version per alias, is that right?
Reading your I understand that API Gateway should contain as many initial resources as aliases and then the master API hanging from there although it doesn't, but this is just a guess
cloudformation-template-update-alias-stack.json cloudformation-template-create-alias-stack.json
Both containing information only about the last alias deployed, in this case v2
Any suggestion?