我将在 AWS 上构建微服务架构,我想请您澄清我的疑问。
我目前的一般概念
我想使用 API Gateway,它公开了在 Elastic Beanstalk 中运行的微服务 API。我想将 Elastic Beanstalk 放置在 VPC 中,而无需从 Internet 直接访问其实例。
问题与疑问:
最佳答案
我将回答不基于意见的观点:
- Elastic Beanstalk gets subdomain on application creation. This subdomain should be used by API Gateway with integration type: AWS service, in action configuration - Am I right?
不,AWS 服务集成仅在您实际调用 时适用。 Elastic Beanstalk服务 .您将调用自己的 beanstalk 实例,以便使用 HTTP 集成。
- What would represent a single microservice? An Elastic Beanstalk's application is a specific scalable microservice?
这取决于您,但正如评论中提到的,许多客户选择通过 Lambda 函数而不是 beanstalk 应用程序来执行此操作。使用 Lambda 的好处是您不需要管理 beanstalk 应用程序的扩展。
- Test environment: What structure should I use in test environment (or staging env.)? I think about creating separate VPC with another Elastic Beanstalk and other Amazon services.
请注意,API Gateway 目前无法联系您 VPC 中的资源。任何 beanstalk 实例都需要可公开访问。
- Test environment and API Gateway: How should I set up an API Gateway? It should allow clients to access the microservices in test environment if request has specific subdomain, like: test.mydomain.com/hello_world/say_hello. I'm not sure how to use API Gateway in CI/CD to make it fast and simple, without manual copying some configuration from test stage to the production stage. (I'm not expecting any complex solution, only some hints about what components, parts, concepts could I use for it. More details I'll find on my own).
你应该看看stage variables .这将允许您使用存储在这些变量中的 dev/test/prod 之间的差异的基本配置。
关于amazon-web-services - AWS API 网关 + Elastic Beanstalk 和微服务,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40660618/