amazon-web-services - AWS API 网关 + Elastic Beanstalk 和微服务

标签 amazon-web-services amazon-elastic-beanstalk microservices aws-api-gateway

我将在 AWS 上构建微服务架构,我想请您澄清我的疑问。

我目前的一般概念

我想使用 API Gateway,它公开了在 Elastic Beanstalk 中运行的微服务 API。我想将 Elastic Beanstalk 放置在 VPC 中,而无需从 Internet 直接访问其实例。

enter image description here

问题与疑问:

  • Elastic Beanstalk 在应用程序创建时获取子域。此子域应由 API Gateway 使用,集成类型为:AWS 服务,实际配置 - 我说的对吗?
  • 什么代表单个微服务? Elastic Beanstalk 的应用程序是特定的可扩展微服务吗?
  • 微服务应该如何相互通信?我将在某些任务中使用 SQS(简单队列服务)。但在其他情况下,两个微服务通过 API 网关而不是直接进行通信会更好吗?我说的对吗?
  • 测试环境:我应该在测试环境(或暂存环境)中使用什么结构?我考虑使用另一个 Elastic Beanstalk 和其他 Amazon 服务创建单独的 VPC。
  • 测试环境和 API 网关:我应该如何设置 API 网关?如果请求具有特定的子域,它应该允许客户端访问测试环境中的微服务,例如:test.mydomain.com/hello_world/say_hello。我不确定如何在 CI/CD 中使用 API Gateway 使其快速简单,无需手动将一些配置从测试阶段复制到生产阶段。 (我不期待任何复杂的解决方案,只有一些关于我可以使用哪些组件、部件、概念的提示。更多细节我会自己找到)。
  • 您是否有使用 Codep Deploy 和/或 Jenkins 将应用程序部署到 Elastic Beanstalk 的经验?我很感兴趣哪种方式会更好:Jenkins、AWS Code Deploy 或 Jenkins+CodeDeploy。
  • 最佳答案

    我将回答不基于意见的观点:

    1. 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 集成。

    1. What would represent a single microservice? An Elastic Beanstalk's application is a specific scalable microservice?


    这取决于您,但正如评论中提到的,许多客户选择通过 Lambda 函数而不是 beanstalk 应用程序来执行此操作。使用 Lambda 的好处是您不需要管理 beanstalk 应用程序的扩展。

    1. 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 实例都需要可公开访问。

    1. 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/

    相关文章:

    web-services - AWS S3 的动态使用

    firebase - 应用程序的 Firebase 托管中的微服务部署

    java - 文件上传spring cloud feign客户端

    amazon-web-services - 通过 CloudFormation 将项目放入 DynamoDB 表中

    apache - AWS EC2 实例 - Apache/Ubuntu 12.04 和 Neo4j 1.9.1

    amazon-web-services - 在 AWS Elastic Beanstalk 上安装 bcrypt 失败

    docker - 弹性 beantalk 找不到 Dockerfile

    spring - 具有多个实例的微服务事件驱动设计

    javascript - 有和/或没有类型的 AWS DynamoDB 数据?

    ruby-on-rails - Elastic Beanstalk : customize Puma configuration