如何将 EC2 负载均衡器与 AWS Lightsail 实例结合使用?

How do I use a EC2 load balancer with AWS Lightsail instance?

我正在尝试在我的 AWS lightsail 实例负载均衡器中安装通配符证书。 但是 Lightsail 实例不允许通配符证书。尽管 EC2 负载均衡器允许通配符证书。谁能解释我如何将 EC2 负载均衡器与 Lightsail 实例一起使用?

科林先生的这一步我试过了。

但是我没有看到我的实例,谁能提供更多细节

从负载均衡器的目标组创建中,有一个选项使用 IP address 而不是 Instance

因此,如果您错误地创建了 Instance 选项,您需要:

1) 在 IP address 选项下创建另一个目标组。

2) 将您的 LightSail 实例的私有 IP 地址添加到新的目标组中。

3) 确保您的 LightSail 安全组允许负载均衡器进行健康检查。

不幸的是,根据我的研究,AWS Lightsail 不能直接使用带有 regular/non-Lightsail 服务的私有 IP 地址访问,因为 Lightsail 不使用您的常规 VPC。

这包括并特别影响 EC2 (Application/Network) 负载均衡器。

use Lightsail with other AWS services, you can set up VPC Peering. For how much, you may ask?

There is no charge for setting up or running a VPC peering connection. Data transferred across peering connections is charged at [=10=].01/GB for send and receive, regardless of the Availability Zones involved.

因此,根据您的优先级,您的选择包括:

  1. 切换到 EC2,这将为您提供更大的灵活性和(取决于实例类型)有保证的性能。 Lightsail 实例使用可突发实例,可与 EC2 的 t3 实例相媲美。
  2. 在 Lightsail 中安装 nginx 作为端口 80 and/or 443 上的反向代理,因此扩展您的选择以直接使用它或使用外部 CDN/Load 平衡器,例如 CloudFlare。
  3. 使用 Lightsail 负载均衡器,不使用通配符证书。