2

Hi I am trying to create a schedule with aws eventbridge scheduler and reffering the documentation from the aws-sdk for php

I am getting an error as

Parameter is not valid. Reason: Provided Arn is not in correct format.

Below is the code i am using

$result = $AwsSchedulerClient->createSchedule([
            'ClientToken' => 'test_1',
            'Description' => 'test scheduler',
            'FlexibleTimeWindow' => [ 
                'Mode' => 'OFF',
            ],
            'Name' => 'test_scheduler', 
            'ScheduleExpression' => 'at(2023-04-05T08:00:00)', 
            'State' => 'ENABLED',
            'Target' => [ 
                'Arn' => 'Arn name copied from aws console for api destination',
                'RoleArn' => 'role arn copied from aws console',
            ],
        ]);

any help will be appreciated

1 Answer 1

2

Below is the correct solution which is working for me, for Arn you have to give service arn arn:aws:scheduler:::aws-sdk:eventbridge:createApiDestination and add filed input and give the relevent object there.

$result = $AwsSchedulerClient->createSchedule([
                    'ClientToken' => 'test_2',
                    'Description' => 'test scheduler',
                    'FlexibleTimeWindow' => [ 
                        'Mode' => 'OFF',
                    ],
                    'Name' => 'test_scheduler2', 
                    'ScheduleExpression' => 'at(2023-04-12T08:00:00)', // REQUIRED
                    'State' => 'ENABLED',
                    'Target' => [ 
                        'Arn' => 'arn:aws:scheduler:::aws-sdk:eventbridge:createApiDestination', //need to add this service name not the arn name of api destination
                        'RoleArn' => '<role arn with relevent permission>',
                        'Input' => json_encode([
                            'ConnectionArn' => '<ConnectionArn Name>', 
                            'Description' => 'schedulerAPIs2',
                            'HttpMethod' => 'POST', 
                            'InvocationEndpoint' => 'endpoint url', 
                            'InvocationRateLimitPerSecond' => 10,
                            'Name' => 'schedulerAPIs3', 
                        ]),
                    ],
                ]);
Sign up to request clarification or add additional context in comments.

1 Comment

does this create a new API destination everytime a Scheduler was created? @Hussain

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.