-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Open
Labels
aws:route53Amazon Route 53Amazon Route 53status: backlogTriaged but not yet being worked onTriaged but not yet being worked ontype: bugBug reportBug report
Description
Is there an existing issue for this?
- I have searched the existing issues
Current Behavior
I am using localstack to test route53 record creation, and deletion. What I found, that creation and deletion of same record multiple times is not possible.
Expected Behavior
Should be able to create and delete records multiple times
How are you starting LocalStack?
With a docker-compose file
Steps To Reproduce
How are you starting localstack (e.g., bin/localstack
command, arguments, or docker-compose.yml
)
services:
localstack:
container_name: "${LOCALSTACK_DOCKER_NAME:-localstack-main}"
image: localstack/localstack:4.6.0
# image: localstack/localstack-pro:4.6.0
ports:
- "127.0.0.1:4566:4566" # LocalStack Gateway
- "127.0.0.1:4510-4559:4510-4559" # external services port range
environment:
# LocalStack configuration: https://docs.localstack.cloud/references/configuration/
# ref: https://docs.localstack.cloud/aws/capabilities/config/configuration/
# - DEBUG=${DEBUG:-0}
- DEBUG=1
- DEFAULT_REGION=eu-west-1
Client commands (e.g., AWS SDK code snippet, or sequence of "awslocal" commands)
export AWS_REGION=eu-west-1
export AWS_ACCESS_KEY_ID=foo
export AWS_SECRET_ACCESS_KEY=bar
export AWS_ENDPOINT_URL=http://localhost:4566
aws route53 create-hosted-zone --name example.com --caller-reference $(date +%s) --hosted-zone-config Comment="test"
aws route53 change-resource-record-sets \
--hosted-zone-id $HOSTED_ZONE_ID \
--change-batch '{"Changes":[{"Action":"CREATE","ResourceRecordSet":{"Name":"foo.example.com.","Type":"A","ResourceRecords":[{"Value":"5.6.7.8"}]}},{"Action":"CREATE","ResourceRecordSet":{"Name":"a-foo.example.com.","Type":"TXT","ResourceRecords":[{"Value":"heritage=external-dns,external-dns/owner=default,external-dns/resource=service/extdns/with-ampersand"}]}}]}'
sleep 5
aws route53 change-resource-record-sets \
--hosted-zone-id $HOSTED_ZONE_ID \
--change-batch '{"Changes":[{"Action":"DELETE","ResourceRecordSet":{"Name":"foo.example.com.","Type":"A","ResourceRecords":[{"Value":"5.6.7.8"}]}},{"Action":"DELETE","ResourceRecordSet":{"Name":"a-foo.example.com.","Type":"TXT","ResourceRecords":[{"Value":"heritage=external-dns,external-dns/owner=default,external-dns/resource=service/extdns/with-ampersand"}]}}]}'
sleep 5
aws route53 change-resource-record-sets \
--hosted-zone-id $HOSTED_ZONE_ID \
--change-batch '{"Changes":[{"Action":"CREATE","ResourceRecordSet":{"Name":"foo.example.com.","Type":"A","ResourceRecords":[{"Value":"5.6.7.8"}]}},{"Action":"CREATE","ResourceRecordSet":{"Name":"a-foo.example.com.","Type":"TXT","ResourceRecords":[{"Value":"heritage=external-dns,external-dns/owner=default,external-dns/resource=service/extdns/with-ampersand"}]}}]}'
The last command will fail with error
An error occurred (InvalidChangeBatch) when calling the ChangeResourceRecordSets operation: Tried to create resource record set [name='foo.example.com.', type='A'] but it already exists
Even if records not exists (successfully deleted)
zones=$(aws route53 list-hosted-zones-by-name --query "HostedZones[].Id" --output json)
echo "$zones" | jq -r '.[]' | while IFS= read -r hosted_zone_id; do
zone=${hosted_zone_id#"/hostedzone/"}
echo "Checking records for zone: $zone"
aws route53 list-resource-record-sets --hosted-zone-id ${zone} --output json
done
Environment
- OS: macos
- LocalStack: communite/prod
LocalStack version: 4.6.0
LocalStack Docker image sha: 467827579d31
LocalStack build date: 2025-07-03
LocalStack build git hash: b16cabc9b
Anything else?
No response
Metadata
Metadata
Assignees
Labels
aws:route53Amazon Route 53Amazon Route 53status: backlogTriaged but not yet being worked onTriaged but not yet being worked ontype: bugBug reportBug report