How to associate an AWS Lambda alias with an API Gateway

How to associate an AWS Lambda alias with an API Gateway

Lambda is $LATEST is up-to-date and can be versioned. In addition, there are aliases.

If you want to version your current Lambda, press “Publish new version”.

AWS LambdaのエイリアスとAPI Gatewayを関連付ける方法

Name it “version2” or something appropriate.

Next, press the “Create Alias” button.

AWS LambdaのエイリアスとAPI Gatewayを関連付ける方法

Create it with the name “dev”.

AWS LambdaのエイリアスとAPI Gatewayを関連付ける方法

On the API Gateway side, set the backend Lambda as “alias:lambda name” as in “aliastestlambda:dev”.

AWS LambdaのエイリアスとAPI Gatewayを関連付ける方法

${stageVariables.alias}

You can also write “dev” as a bare string, or you can use stage variables by specifying ${stageVariables.alias}. Write the backend Lambda as “aliastestlambda:${stageVariables.alias}”.

AWS LambdaのエイリアスとAPI Gatewayを関連付ける方法

Now you can associate the stage variable with the name “alias” and the value “dev” and it is OK. Finally, you can deploy and confirm that Lambda is executed.

AWS LambdaのエイリアスとAPI Gatewayを関連付ける方法

コメント

Discover more from 株式会社CONFRAGE ITソリューション事業部

Subscribe now to keep reading and get access to the full archive.

Continue reading

Copied title and URL