How to Schedule a start of DMS task by AWS EventBridge via CloudFormation template?

0

Hello , 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?

2 Answers
0
Accepted Answer

Hi.

You need to use a Universal Target. So the ARN need to be a ARN pointing to the DMS api action, in the following format arn:aws:scheduler:::aws-sdk:databasemigration:[apiAction]

DMS is not supported as a Templated Target that you are trying to use in the CloudFormation template, you need to change the ARN to a Universal Target.

profile picture
EXPERT
answered 10 months ago
  • Thank you, I tried with this approach and now it is working fine.

0

Perhaps the target ARN is in the wrong format.
Create a scheduler once from the management console and then check the scheduler with the following command to see if the target ARN format is correct.

aws scheduler get-schedule --name schedule_name
profile picture
EXPERT
answered 10 months ago
  • Okay, Thank you, Let me check that.

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions