providing table mapping in JSONObject for AWS::DMS::ReplicationConfig in cloud formation -

0

I'm trying to create a simple cloud formation script for creating resource : AWS::DMS::ReplicationConfig ( refering documentation: https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationconfig.html#cfn-dms-replicationconfig-tablemappings ), below is the snippet of the script i'm using. I'm getting error : * Properties validation failed for resource DMSReplicationConfig with message: [#/TableMappings: expected type: JSONObject, found: String]* , while providing table mapping json .

Not sure how to provide the table mapping as JSONObject. Could someone please help.

Snippet:

DMSReplicationConfig: Type: 'AWS::DMS::ReplicationConfig' Properties: ComputeConfig: AvailabilityZone: 'multi' MinCapacityUnits: 2 MaxCapacityUnits: 8 ReplicationSubnetGroupId: 'default-vpc-0a37fbbxxxxxxxxxx' VpcSecurityGroupIds: - 'sg-0730d88xxxxxxxxxx' SourceEndpointArn: !Ref DmsSourceEndpoint TargetEndpointArn: !Ref DMSTargetEndpoint ReplicationType: 'full-load-and-cdc' TableMappings: | { "rules": [ { "rule-type": "selection", "rule-id": "1", "rule-name": "SchemaMapping", "object-locator": { "schema-name": "otp" }, "rule-action": "include" }, { "rule-type": "selection", "rule-id": "2", "rule-name": "TableMapping", "object-locator": { "schema-name": "otp", "table-name": "audit" }, "rule-action": "include" }, { "rule-type": "selection", "rule-id": "3", "rule-name": "TableMapping", "object-locator": { "schema-name": "otp", "table-name": "client" }, "rule-action": "include" } ] }

1 Antwort
0

Hello,

Thank you for writing on re:Post.

From the case description, I understand that you are getting below error while creating the resource type 'AWS::DMS::ReplicationConfig' and therefore you want guidance on how to resolve this error.

Error: Properties validation failed for resource DMSReplicationConfig with message: [#/TableMappings: expected type: JSONObject, found: String]

Please note that, the resource type "AWS::DMS::ReplicationConfig" property 'TableMappings' is expecting a JSON object. To solve this issue, we can pass the 'TableMappings' property values as Json directly and in your case you will require to remove the extra '|' pipe sign and it will work. Further, you can also provide the list of JSON Objects to 'TableMappings' property.

I tried with the below code and noted no validation errors on my end. I was able to upload the template and get to stack creation with no issues. Please check the below snippets:

Example 1:

Resources:
  ReplicationConfig:
    Type: AWS::DMS::ReplicationConfig
    Properties:
      ReplicationConfigIdentifier: DMSReplicationConfig
      ComputeConfig:
        MaxCapacityUnits: '16'
        MinCapacityUnits: '8'
        MultiAZ: 'false'
      ReplicationType: full-load-and-cdc
      SourceEndpointArn: arn:aws:dms:us-east-1:<acc-id>:endpoint:OA7LVK3IJZBPHP5BNNCFHHBBU
      TargetEndpointArn: arn:aws:dms:us-east-1:<acc-id>:endpoint:UIRGNKSFJVAYLCDNSJJITBPE
      TableMappings:
        rules:
          - rule-type: selection
            rule-id: '713963603'
            rule-name: '713963603'
            object-locator:
              schema-name: '%'
              table-name: '%'
            rule-action: include
            filters: []
          - rule-id: '063767275'
            rule-name: '063767275'
            rule-type: selection
            rule-action: include
            object-locator:
              schema-name: public
              table-name: team
            filters: []

Example 2:

Resources:
  ReplicationConfig:
    Type: AWS::DMS::ReplicationConfig
    Properties:
      ReplicationConfigIdentifier: DMSReplicationConfig1
      ComputeConfig:
        MaxCapacityUnits: '16'
        MinCapacityUnits: '8'
        MultiAZ: 'false'
      ReplicationType: full-load-and-cdc
      SourceEndpointArn: arn:aws:dms:us-east-1:<acc-id>:endpoint:OA7LVK3IJZBPHP5BNNCFHHBBU
      TargetEndpointArn: arn:aws:dms:us-east-1:<acc-id>:endpoint:UIRGNKSFJVAYLCDNSJJITBPE
      TableMappings: { "rules": [ { "rule-type": "selection", "rule-id": "1", "rule-name": "SchemaMapping", "object-locator": { "schema-name": "otp" }, "rule-action": "include" }, { "rule-type": "selection", "rule-id": "2", "rule-name": "TableMapping", "object-locator": { "schema-name": "otp", "table-name": "audit" }, "rule-action": "include" }, { "rule-type": "selection", "rule-id": "3", "rule-name": "TableMapping", "object-locator": { "schema-name": "otp", "table-name": "client" }, "rule-action": "include" } ] }
AWS
beantwortet vor einem Monat

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