2017-07-24 91 views
0

我有一个简单的AWS实现,使用API​​ Gateway,Lambda & DynamoDB。我注意到AWS API网关允许多个阶段。在阅读了一下docs并且随着配置的变化,对我来说,我怎么能够创建可指向新的lambda函数的新端点并不明显。AWS API网关 - 多个阶段

我现在的终点是一样的东西:

https://xxx.execute-api.us-east-1.amazonaws.com/prod/my-mymethod 

我期待创造这样:

https://xxx.execute-api.us-east-1.amazonaws.com/stage/my-mymethod 

这将指向一个独立的lambda表达式。

这究竟是如何完成的?

回答

1

http://docs.aws.amazon.com/apigateway/latest/developerguide/integrating-api-with-aws-services-lambda.html

这将是你把创建PROD一个相同的步骤。

您肯定会使用两个lambda函数,因为它是模块化的,您对原始Lambda的更改将反映在两者上。

1.Create Lambda Function 
2.Create API in API Gateway 
2a Create New, 
2b Click Actions > Create Method > Choose HTTP Method 
2c Whilst HTTP Method is highlighted set "Integration type" to Lambda Function 
2d Choose Lambda Region where your Lambda Function exists 
2e Intellisense will help you fill in the name...