2 Answers
- Newest
- Most votes
- Most comments
2
I also encountered the same problem and found this page. To resolve it, you just need to use "Ttl" instead of "TTL".
"UpsertARecord": {
"Type": "Task",
"Resource": "arn:aws:states:::aws-sdk:route53:changeResourceRecordSets",
"Parameters": {
"HostedZoneId": "yourHostedZoneId",
"ChangeBatch": {
"Changes": [
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "aaa.bbb.domain.",
"Type": "A",
"Ttl.$": "$.TTL.TTL",
"ResourceRecords": [
{
"Value.$": "$.InstanceDetail.Reservations[0].Instances[0].PrivateIpAddress"
}
]
}
}
]
}
},
"ResultPath": "$.ChangeInfo",
"Next": "CheckStatus"
},
The input should look like this.
{
"TTL": { "TTL": 300 }
}
answered 2 years ago
0
TTL field is not directly supported by Step Functions, but you can still use Step Functions . you can use an AWS SDK Lambda function to call the Route 53 API.
just an example please modify
Lambda function
import json
import boto3
route53 = boto3.client('route53')
def lambda_handler(event, context):
hosted_zone_id = event['HostedZoneId']
change_batch = event['ChangeBatch']
response = route53.change_resource_record_sets(
HostedZoneId=hosted_zone_id,
ChangeBatch=change_batch
)
return response
Add the necessary permissions to the Lambda (AmazonRoute53FullAccess policy or a custom policy that allows the route53:ChangeResourceRecordSets)
Step Function
"UpsertARecord": {
"Type": "Task",
"Resource": "arn:aws:lambda:<REGION>:<ACCOUNT_ID>:function:<YOUR_LAMBDA_FUNCTION_NAME>",
"Parameters": {
"HostedZoneId": "xxxxxxxxxxxxxxxxxxx",
"ChangeBatch": {
"Changes": [
{
"Action": "UPSERT",
"ResourceRecordSet": {
"Name": "xxx.yyy.domain.",
"Type": "A",
"TTL.$": "$.TTL.TTL",
"ResourceRecords": [
{
"Value.$": "$.InstanceDetail.Reservations[0].Instances[0].PrivateIpAddress"
}
]
}
}
]
}
},
"ResultPath": "$.ChangeInfo",
"Next": "CheckStatus"
}
Relevant content
- asked 5 years ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 10 months ago
- AWS OFFICIALUpdated 2 years ago
- How do I associate a Route 53 health check from an account with a record set in a different account?AWS OFFICIALUpdated 6 months ago