gpt4 book ai didi

amazon-web-services - 在 GCP 中指向并使用子域

转载 作者:行者123 更新时间:2023-12-04 08:06:46 25 4
gpt4 key购买 nike

我有一个主域 www.example.com在 AWS 上的 Route 53 中设置。

我想指出subdomain1.example.com到 Google Cloud,特别是在 Google Compute Engine 中运行的实例组。

这可能吗?

最佳答案

是的,这是一个很好的设计实践,称为名称服务委托(delegate)。最好的方法是为 GCP 委托(delegate)整个子域,所以让我们使用域 example.com 和 gcp.example.com 作为域和子域。

这样,Google 将为您管理 DNS,而不是您手动更新 route53 中的 A 和 CNAME 记录。

总的来说,这将采取这些步骤 (1) 创建 gcp.example.com GCP 中的区域 (2) 获取 gcp.example.com 的 NS 记录(3) 委派NS对于 gcp.example.com到 Google Cloud NS,然后 (4) 在 GCP Cloud DNS 中创建资源级记录(例如,用于 VM 或 appengine 应用程序)。

(1) 在GCP中创建Zone

这可以在 Network Services -> Cloud DNS 下的控制台中完成。或云壳。我赞成贝壳。

$ gcloud dns managed-zones create gcp-example --description="GCP Example Zone" \
--dns-name="gcp.example.com"

(2) 获取新Zone 的NS Records

下面是一个示例——复制特定于您的 NS 的示例
gcloud dns managed-zones describe gcp-example |grep -A5 nameServers
nameServers:
- ns-cloud-d1.googledomains.com.
- ns-cloud-d2.googledomains.com.
- ns-cloud-d3.googledomains.com.
- ns-cloud-d4.googledomains.com.


(3) 在AWS中添加代理NS记录

创建 update.json (确保值记录正确):
{
"Comment": "CREATE/DELETE/UPSERT a record ",
"Changes": [{
"Action": "CREATE",
"ResourceRecordSet": {
"Name": "gcp.example.com",
"Type": "NS",
"TTL": 300,
"ResourceRecords": [ {"Value" : "ns-cloud-d1.googledomains.com."}, {"Value": "ns-cloud-d2.googledomains.com."},
{"Value" : "ns-cloud-d3.googledomains.com."}, {"Value": "ns-cloud-d4.googledomains.com."}]
}}]
}

HOSTED_ZONE_ID=XXXXXX
aws route53 change-resource-record-sets --hosted-zone-id=${HOSTED_ZONE_ID} --change-batch=file://./update.json
{
"ChangeInfo": {
"Status": "PENDING",
"Comment": "CREATE/DELETE/UPSERT a record ",
"SubmittedAt": "2019-02-27T23:43:35.327Z",
"Id": "/change/XXXXXX"
}
}


(4) 在 GCP Cloud DNS 中,在 gcp.example.com 下创建所有 gcp 资源记录

此时,您可以在 GCP Cloud DNS 中管理所有 GCP dns。继续创建 vm1.gcp.example.comappengine1.gcp.example.com

关于amazon-web-services - 在 GCP 中指向并使用子域,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54915334/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com