2

I am creting a cloudformation template. it is creating Database Migration Service Task. I need to do a scheduling of this DMS taks via EventBridge. I've created following resource in CloudFormation:-

DMSStartTaskScheduler:
      Type: AWS::Scheduler::Schedule
      Properties: 
        FlexibleTimeWindow: 
          MaximumWindowInMinutes: 300
          Mode: FLEXIBLE
        Name: DMSStartTaskRule-dev
        ScheduleExpression: cron(30 17 * * ? *)
        State: ENABLED
        Target: 
          Arn: "DMS task ARN"
          RoleArn: !GetAtt EventBridgeIAMrole.Arn

But Getting below error:-

Invalid request provided: dms is not a supported service for a target. (Service: Scheduler, Status Code: 400,

I tried to create the same Scheduler from Console, there it was working but from Cloudformation template it is giving errors. Can anyone suggest solution of it?

manish soni
  • 515
  • 1
  • 7
  • 19

1 Answers1

0

DMS tasks via EventBridge? Then It should be something like this.

AWSTemplateFormatVersion: 2010-09-09
Resources:
  scheduler:
    Type: 'AWS::Scheduler::Schedule'
    Properties:
      ScheduleExpressionTimezone: "Europe/Kiev"
      ScheduleExpression: cron(*/5 * * * ? *)
      FlexibleTimeWindow: 
        Mode: "OFF"
      State: ENABLED
      Target: 
        Arn: "arn:aws:scheduler:::aws-sdk:databasemigration:startReplicationTask"
        Input: >-
         {"ReplicationTaskArn":"arn:aws:dms:us-east-1:123456789012:replication-config:BGDRG5FD4LPMFOQ7SIJ2RQATROULLBB3WTJWXYY","StartReplicationTaskType":"start-replication"}
        RoleArn: "arn:aws:iam::123456789012:role/MyRoleForEventBridge"

PS: I tested and it worked.

Documentation that helped: https://docs.aws.amazon.com/scheduler/latest/UserGuide/managing-targets-universal.html https://github.com/aws-cloudformation/cloudformation-coverage-roadmap/issues/1549

Hope it helped!

Vasyl Herman
  • 414
  • 2
  • 11