2 回答
- 最新
- 投票最多
- 评论最多
0
Hello.
As far as I know, I don't think there is a way to retrieve the zone file and reconfigure it to Route53.
Therefore, if you want to move your domain to Route53, you will need to copy the record settings one by one.
0
You use this script to generate a zone file, copy the contents and use the "Import zone file" feature.
#!/bin/bash # Variables DOMAIN="[Enter your Domain name]" HOSTED_ZONE_FILE="${DOMAIN}.zone" # Fetch DNS records from Lightsail RECORDS=$(aws lightsail --region us-east-1 get-domain --domain-name $DOMAIN --query 'domain.domainEntries' --output json) # Check if we got a valid response with records if [[ -z "$RECORDS" ]]; then echo "No records found for domain $DOMAIN or error fetching records." exit 1 fi # Start creating the zone file cat > $HOSTED_ZONE_FILE <<EOF \$TTL 86400 ; EOF # Process each record and append to the zone file echo "${RECORDS}" | jq -c '.[]' | while read -r row; do TYPE=$(echo $row | jq -r '.type') NAME=$(echo $row | jq -r '.name') VALUE=$(echo $row | jq -r '.target') # Skip if record type is not recognized or it's an SOA or NS record (already handled) if [[ "$TYPE" == "SOA" || "$TYPE" == "NS" ]]; then continue fi # Append record to zone file based on type case $TYPE in A) echo "$NAME IN A $VALUE" >> $HOSTED_ZONE_FILE ;; CNAME) echo "$NAME IN CNAME $VALUE" >> $HOSTED_ZONE_FILE ;; MX) echo "$NAME IN MX $VALUE" >> $HOSTED_ZONE_FILE ;; TXT) echo "$NAME IN TXT $VALUE" >> $HOSTED_ZONE_FILE ;; *) echo "Unsupported record type: $TYPE" >&2 ;; esac done echo "Zone file created: $HOSTED_ZONE_FILE"
已回答 6 个月前
相关内容
- AWS 官方已更新 3 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 1 年前
- AWS 官方已更新 2 年前