Search code examples
amazon-web-servicesloggingaws-cloudformationamazon-cloudwatchaws-dms

AWS DMS with cloudformation enabling logging needs a log group


I'm doing all of this with Cloudformation. I've tried to enable logging for already working replication task, but I can't see the logs anywhere, it seems that a group should be created for the logs and there is no option like that in the documentation. I cannot find the parameter of the log group in the docs of Replication Task.[1] [2] [3]

Here's my replication task.

ReplicationTask:
    Type: 'AWS::DMS::ReplicationTask'
    Properties:
      SourceEndpointArn: !Ref SourceEndpoint
      TargetEndpointArn: !Ref TargetEndpoint
      ReplicationInstanceArn: !Ref ReplicationInstance
      MigrationType: 'full-load'
      TableMappings: '
      {
        "rules": [
          {
            "rule-type": "selection",
            "rule-id": "1",
            "rule-name": "1",
            "object-locator": {
              "schema-name": "%",
              "table-name": "%"
            },
            "rule-action": "include"
          }
        ]
      }'
      ReplicationTaskSettings: '
          {
              "Logging": {
                "EnableLogging": true,
                "LogComponents": [{
                    "Id": "SOURCE_UNLOAD",
                    "Severity": "LOGGER_SEVERITY_DEFAULT"
                },{
                    "Id": "SOURCE_CAPTURE",
                    "Severity": "LOGGER_SEVERITY_DEFAULT"
                },{
                    "Id": "TARGET_LOAD",
                    "Severity": "LOGGER_SEVERITY_DEFAULT"
                },{
                    "Id": "TARGET_APPLY",
                    "Severity": "LOGGER_SEVERITY_INFO"
                },{
                    "Id": "TASK_MANAGER",
                    "Severity": "LOGGER_SEVERITY_DEBUG"
                }]
              },
          }'

when I click on replication task, i see a link in the logs tab that takes me to cloud watch where I see an error Log group not found

References:

[1] http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-dms-replicationtask.html

[2] http://docs.aws.amazon.com/dms/latest/userguide/CHAP_Tasks.CustomizingTasks.TaskSettings.html

[3] http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-logs-loggroup.html


Solution

  • You need to set it for the user. These documentation links give you more insight.

    1. https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Security.APIRole.html
    2. https://docs.aws.amazon.com/dms/latest/userguide/CHAP_Security.IAMPermissions.html

    You need to create these roles in advance, or create in CloudFormation template.

    Edit: It appears that sometimes the new AWS Console fails to create both of these IAM roles automatically. So you may need to create them manually.