Cloudformation - DMS Replication task

0

Cloudformation DMS replication task, TableMappings: , doesn't take json. Error Invalid JSON but I have checked in JSON checker, JSON is valid. Please let me know if there is any way to provided JSON file has input. sample JSON File.

{
    "rules": [
        {
            "rule-type": "selection",
            "rule-id": "528656830",
            "rule-name": "528624433",
            "object-locator": {
                "schema-name": "APPLSYS",
                "table-name": "FND_CURRENCIES"
            },
            "rule-action": "include",
            "filters": []
        }
    ]
}
gefragt vor 2 Jahren769 Aufrufe
1 Antwort
1

Hi,

The property TableMappings of the resource AWS::DMS::ReplicationTask accepts a single String:

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#aws-resource-dms-replicationtask-properties

As the double quote (") is a String delimiter in the CloudFormation YAML Syntax you need to escape the double quotes of your JSON string, as shown in the example:

AWSTemplateFormatVersion: 2010-09-09
Resources: 
  myReplicationTask: 
    Properties: 
      MigrationType: full-load
      ReplicationInstanceArn: ReplicationInstance
      SourceEndpointArn: SourceEndpoint
      TableMappings: "{ \"rules\": [ { \"rule-type\": \"selection\", \"rule-id\": \"1\", \"rule-name\": \"1\", \"object-locator\": { \"schema-name\": \"%\", \"table-name\": \"%\" }, \"rule-action\": \"include\" } ] }"
      TargetEndpointArn: TargetEndpoint
    Type: "AWS::DMS::ReplicationTask"

source: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html#aws-resource-dms-replicationtask--examples

EXPERTE
beantwortet vor 2 Jahren
  • Thanks, actually I got the solution before your reply. JSON was correctly formatted, it wasn't taking it as string, hence JSON had to be within single quote.

    TableMappings: '{ "rules": [ { "rule-type": "selection", "rule-id": "528656830", "rule-name": "528624433", "object-locator": { "schema-name": "APPLSYS", "table-name": "FND_CURRENCIES" }, "rule-action": "include", "filters": [] } } ] }'

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen