aws-solutions / instance-scheduler-on-aws

A cross-account and cross-region solution that allows customers to automatically start and stop EC2 and RDS Instances
https://aws.amazon.com/solutions/implementations/instance-scheduler-on-aws/
Apache License 2.0
542 stars 264 forks source link

scheduler-cli Timezone Error #514

Closed dubrowin closed 7 months ago

dubrowin commented 7 months ago

Describe the bug

When I try to create a schedule or update a schedule with a timezone, I receive an error

To Reproduce

I installed the schedule-cli on CloudShell and ran the below:

scheduler-cli update-schedule --stack shlomod-instance-scheduler --name my-office-hours-schedule -–timezone 'Asia/Jerusalem'
usage: scheduler-cli [-h] [--version] {create-period,create-schedule,delete-period,delete-schedule,describe-periods,describe-schedule-usage,describe-schedules,update-period,update-schedule} ...
scheduler-cli: error: unrecognized arguments: -–timezone Asia/Jerusalem

according to the documentation, this should be a supported timezone.

https://docs.aws.amazon.com/solutions/latest/instance-scheduler-on-aws/schedules.html

Expected behavior

The scheduler-cli should accept the timezone and configure it in the DynamoDB table correctly.

Please complete the following information about the solution:

'scheduler-cli 1.5.3'

To get the version of the solution, you can look at the description of the created CloudFormation stack. For example, "(SO0030) instance-scheduler-on-aws v1.5.1". You can also find the version from releases

Additional context Add any other context about the problem here.

CrypticCabub commented 7 months ago

hi @dubrowin

The error you describe indicates a malformed input to the cli rather than there being a problem with the timezone you provided. I copy-pasted the command you provided exactly as-is, and it looks like the second dash in --timezone is not actually a hyphen but some other character, so the cli is failing to parse it. When I correct this, the cli accepts your command without problem (though it does complain that you must provide some periods for your schedule as the update command is a full replacement, not just updating a single value)

dubrowin commented 7 months ago

Thank you Caleb for the explanation. That faulty dash (-) was taken directly from the AWS Documentation

https://docs.aws.amazon.com/solutions/latest/instance-scheduler-on-aws/sample-schedule.html

CrypticCabub commented 7 months ago

Thanks @dubrowin! We'll get that fixed in the doc