本文介绍了指向 Elastic Beanstalk 环境的外部子域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在这种特殊情况下,我在不同的提供商(AWS 除外)中有一个域和一个 Elastic Beanstalk (EB) 应用程序,其中有多个环境,每个环境都使用不同的资源.

In this particular case, I have a domain in a different provider (other than AWS) and an Elastic Beanstalk (EB) application with multiple environments that each use different resources.

从域提供商处,我创建了一个名为 - test.tiagoperes.eu 的子域.

From the domain provider, I've created a subdomain named - test.tiagoperes.eu.

我想要的是,通过转到此子域,任何用户都将看到当前在名为 production 的 EB 环境中找到的内容,该环境当前在 (app-prod 不是真实名称,而是跟随类似的模式)

What I want is that by going to this subdomain, any user would see what's currently found in the EB environment named production which is currently accessed in (app-prod is not the real name but follows a similar pattern)

app-prod.eba-xepr49ar.us-east-1.elasticbeanstalk.com

这是一个包含 Auto Scaling 组、目标组和负载均衡器的环境.

This is an environment with Auto Scaling Group, Target Group and Load Balancer.

必须做什么?

注意:有一个类似的问题,但它非常笼统(因此答案).此外,在基本 EB 环境中使用了这个问题.另外,我看过本指南.

Note: There's a similar question but it is very general (hence the variety of answers). Also, there's this question used in a basic EB environment. Also, I've looked at this guide.

推荐答案

基于评论.

OP 使用外部 DNS 提供商(不是 AWS Route53).因此,应该为子域创建 CNAME 记录或外部提供商中的等效记录.该记录应解析为 ElasticBeanstaslk 上的默认名称.

The OP uses external DNS provider (not AWS Route53). Thus, CNAME record, or equivalent in the external provider, should be created for the subdomain. The record should resolve to the default name of on ElasticBeanstaslk.

由于 DNS 提供商在 AWS 外部,无需在 AWS 上做任何事情.

Since the DNS provider is external to AWS, there is no need to do anything at the AWS.

更详细地,在域的 DNS 管理器中,为子域创建 CNAME 记录.例如,如果 EB 子域是:app-prod.eba-xepr49ar.us-east-1.elasticbeanstalk.com 那么我们应该有一个 app-prod.eba- 的 CNAME 条目xepr49ar.us-east-1.elasticbeanstalk.com.根据 马克 B

In more detail, in the DNS manager of the domain, create a CNAME record for the subdomain. For example, if the EB subdomain is: app-prod.eba-xepr49ar.us-east-1.elasticbeanstalk.com then we should have a CNAME entry for app-prod.eba-xepr49ar.us-east-1.elasticbeanstalk.com. According to Mark B

我们永远不应该使用 Elastic Beanstalk (EB) 直接指向服务器/IP 地址,它应该始终使用 Elastic Beanstalk 提供的 DNS 端点.

根据我们使用的 DNS 主机,可以自己添加 CNAME 记录,或者我们可能需要主机为我们添加它.作为示例,他们的文档中解释了如何在 Namecheap 和 GoDaddy 中执行此操作:

Depending on the DNS host we are using, one can add the CNAME record ourselves, or we may need the host to add it for us. As examples, how to do it in Namecheap and GoDaddy is explained in their docs:

这篇关于指向 Elastic Beanstalk 环境的外部子域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-29 07:31