Amazon.Scheduler.Model.ValidationException: 'batch is not a supported service for a target.' #3134
-
Describe the bugI am trying to submit a batch job based on a schedule, using Event bridge scheduler (not using Eventbridge rules because of the max limit of 300 it has) But when I call the CreateScheduleAsync method with the batch config using .Net SDK, I get a error message saying batch is not supported as a target. Expected BehaviorTargetting a batch job through scheduler is possible on the AWS console, So I am expecting it to work with the SDK as well. Current BehaviorThis is the error message I get - "Amazon.Scheduler.Model.ValidationException: 'batch is not a supported service for a target.'" Reproduction Steps var schedulerClient = new AmazonSchedulerClient();
var scheduleJobInput = new
{
JobDefinition = <jobDefinitionName>,
JobName = <jobName>,
JobQueue = <jobQueueName>,
ContainerOverrides = new ContainerOverridesCustom
{
Command = new List<string>() { "some test data" }
},
Timeout = new JobTimeoutCustom
{
AttemptDurationSeconds = <timeout>
}
};
var scheduleTimeWindow = new FlexibleTimeWindow
{
Mode = FlexibleTimeWindowMode.OFF
};
var invokeBatchTarget = new Amazon.Scheduler.Model.Target
{
Arn = <jobQueueName>,
RoleArn = <roleArn>,
Input = JsonConvert.SerializeObject(scheduleJobInput)
};
var createScheduleRequest = new CreateScheduleRequest
{
Name = <scheduler-name>,
ScheduleExpression = "cron(0 12 * * ? *)",
State = ScheduleState.ENABLED,
Description = <scheduler-description>,
FlexibleTimeWindow = scheduleTimeWindow,
Target = invokeBatchTarget,
GroupName = <scheduler-group-name>
};
var createScheduleResponse = await schedulerClient.CreateScheduleAsync(createScheduleRequest); AWS .NET SDK and/or Package version usedAWSSDK.Scheduler- 3.7.300.16 Targeted .NET Platform.NET 6.0 Operating System and versionWindows 10 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 4 replies
-
Are you able to create the schedule using the equivalent AWS CLI command? Our client is generated from the service model, we don't explicitly throw that validation exception. |
Beta Was this translation helpful? Give feedback.
Thanks for taking a look.
What did you specify for the
Amazon.Scheduler.Model.Target.Arn
property? I checked and the console usesarn:aws:scheduler:::aws-sdk:batch:submitJob
.If I use this snippet the scheduler is created successfully: