使用 Elastic Beanstalk 部署的应用程序上的弹性 IP [英] Elastic IP on application deployed using Elastic Beanstalk

查看:20
本文介绍了使用 Elastic Beanstalk 部署的应用程序上的弹性 IP的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用 Amazazon Web Services 提供的 Elastic IP 服务有点困惑.我想主要想法是我可以按照这个简单的过程切换到新版本的 Web 应用程序,而无需停机:

I'm a bit confused about the use of the Elastic IP service offered by Amazazon Web Services. I guess the main idea is that I can switch to a new version of the web application with no downtime following this simple procedure:

  1. 在新的 EC2 实例上部署新版本
  2. 正确配置新版本并使用暂存数据库对其进行测试
  3. 经过正确测试后,让这个新版本使用实时数据库
  4. 将弹性 IP 关联到此实例
  5. 终止所有无用的服务(临时数据库和旧的 EC2 实例)

这是部署新版本 Web 应用程序的常用方法吗?

Is this the common way to deploy a new version of a web application?

现在,如果应用程序在更多实例上扩展会怎样?我在 Elastic Beanstalk 设置中配置了自动扩展,这创建了一个负载均衡器(我可以在 AWS 管理控制台的 EC2 部分看到它).问题是我显然无法将弹性 IP 与负载均衡器相关联,我必须将其与现有实例相关联.我应该将它关联到哪个实例?我很困惑...

Now, what if the application is scaled on more instances? I configured the auto scaling in the Elastic Beanstalk settings and this created a load balancer (I can it see in the EC2 section of the AWS Management Console). The problem is that I apparently cannot associate the Elastic IP with the load balancer, I have to associate it with an existing instance. To which instance should I associate it to? I'm confused...

抱歉,有些问题可能听起来很愚蠢,但我只是一名程序员,这是我第一次设置云系统.

Sorry if some questions may sound stupid but I'm only a programmer and this is the first time I set up a cloud system.

谢谢!

推荐答案

Elastic Load Balancing (ELB) 不适用于 Amazon EC2 弹性 IP 地址,实际上这两个概念在全部.

Elastic Load Balancing (ELB) does not work with Amazon EC2 Elastic IP addresses, in fact the two concepts do not go together at all.

相反,ELB 通常通过 CNAME 记录 使用(但见下文),这提供了如果需要,允许别名 DNS 地址更改正在使用的 ELB 的 IP,从而实现第一级弹性/可用性.第二级弹性/可用性由负载均衡器在您注册的 EC2 实例之间分配流量时执行.

Rather, ELB is usually used via CNAME records (but see below), and this provides the first level of elasticity/availability by allowing the aliased DNS address to change the IP of the ELB(s) in use, if need be. The second level of elasticity/availability is performed by the load balancer when distributing the traffic between the EC2 instances you have registered.

这样想:CNAME 永远不会改变(就像弹性 IP 地址)并且 EC2 实例的替换是通过负载均衡器处理的,Auto Scaling,或您自己(通过注册/取消注册实例).

Think of it this way: The CNAME never changes (just like the Elastic IP address) and the replacement of EC2 instances is handled via the load balancer, Auto Scaling, or yourself (by registering/unregistering instances).

这在 Shlomo Swidler 出色的分析中有更详细的解释 Elastic Load Balancing"中的Elastic":ELB Elasticity and How to Test it,又指最近提供的AWS 评估 Elastic Load Balancing 的最佳实践,证实了他的分析,并提供了关于Elastic Load Balancing 服务的架构及其工作原理 本身(但缺少 Shlomo 提供的说明性分步示例).

This is explained in more detail within Shlomo Swidler's excellent analysis The "Elastic" in "Elastic Load Balancing": ELB Elasticity and How to Test it, which in turn refers to the recently provided Best Practices in Evaluating Elastic Load Balancing by AWS, which confirm his analysis and provide a good overall read regarding the Architecture of the Elastic Load Balancing Service and How It Works in itself (but lacks the illustrative step by step samples Shlomo provides).

请注意,之前需要 CNAME 的限制已通过分别添加到 Amazon Route 53 要允许使用根域(或Zone Apex),请参阅继续使用 Amazon Route 53 以获取快速概览和 将域名与 Elastic Load Balancing 结合使用 了解详情.

Please note that the former limitation requiring a CNAME has meanwhile been addressed by respective additions to Amazon Route 53 to allow the root domain (or Zone Apex) being used as well, see section Aliases and the Zone Apex within Moving Ahead With Amazon Route 53 for a quick overview and Using Domain Names with Elastic Load Balancing for details.

首先,AWS Elastic Beanstalk 如上所述依次使用 Elastic Load Balancing.最重要的是,它添加了应用程序生命周期管理:

First and foremost, AWS Elastic Beanstalk uses Elastic Load Balancing in turn as described above. On top if that, it adds application lifecycle management:

AWS Elastic Beanstalk 是一种让您快速部署的更简单的方法并在 AWS 云中管理应用程序.您只需上传您的应用程序,Elastic Beanstalk 会自动处理容量供应、负载平衡的部署细节,自动缩放和应用程序运行状况监控.[...] [强调我的]

AWS Elastic Beanstalk is an even easier way for you to quickly deploy and manage applications in the AWS cloud. You simply upload your application, and Elastic Beanstalk automatically handles the deployment details of capacity provisioning, load balancing, auto-scaling, and application health monitoring. [...] [emphasis mine]

这是通过在混合中添加环境的概念来实现的,这在 架构概览:

This is achieved by adding the concept of an Environment into the mix, which is explained in the Architectural Overview:

环境是应用程序的核心.[...] 当您创建环境,AWS Elastic Beanstalk 预置资源需要运行您的应用程序.为一个创建的 AWS 资源环境包括一个弹性负载均衡器(图中的 ELB)、一个Auto Scaling 组和一个或多个 Amazon EC2 实例.

The environment is the heart of the application. [...] When you create an environment, AWS Elastic Beanstalk provisions the resources required to run your application. AWS resources created for an environment include one elastic load balancer (ELB in the diagram), an Auto Scaling group, and one or more Amazon EC2 instances.

请注意,每个环境都有一个指向负载均衡器的 CNAME (URL),即就像单独使用 ELB 一样.

Please note that Every environment has a CNAME (URL) that points to a load balancer, i.e. just like using an ELB on its own.

所有这些都集中在 管理和配置应用程序和环境,其中详细讨论了 AWS Elastic Beanstalk 的一些最重要的功能,包括使用 AWS 管理控制台、CLI 和 API 的使用示例.

All this comes together in Managing and Configuring Applications and Environments, which discusses some of the most important features of AWS Elastic Beanstalk in detail, including usage examples using the AWS Management Console, CLI, and the APIs.

为了说明目的,很难确定最相关的部分,但是 以零停机时间部署版本 准确地解决了您的用例并暗示了所有必需的先前步骤(例如 创建新的应用程序版本启动新环境),因此阅读AWS 管理控制台部分可能会让您对这个平台的工作原理有一个最好的了解.

Its hard to identify the most relevant part for illustration purposes, but Deploying Versions With Zero Downtime precisely addresses your use case and implies all required preceding steps (e.g. Creating New Application Versions and Launching New Environments), so reading section AWS Management Console might give you the best overall picture how this platform works.

祝你好运!

这篇关于使用 Elastic Beanstalk 部署的应用程序上的弹性 IP的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆