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

Cannot update / delete schedules after upgrade to 3.0.1 #562

Closed gmergulhao closed 1 month ago

gmergulhao commented 1 month ago

Describe the bug

Cannot update or delete stacks which handle schedules. Lambda no longer accepts property 'UseMaintenanceWindow'

After upgrading from 1.5.3 we noticed that one can no longer update or even successfully delete stacks which created schedules. This has been done so for about 5 years, according to aws documentation

The lambda InstanceSchedulerMain no longer accepts the property 'UseMaintenanceWindow', which differs from the documentation above, and returns error to cloudformation. The same behaviour occurs when trying to delete the stack (which sends event delete to lambda) or even updating the stack to a new template version which does not include 'UseMaintenanceWindow'. The lambda apparently still checks all properties within 'OldResourceProperties' as it is part of the event.

To Reproduce

Expected behavior

information about the solution:

event of a request 'update' with the property 'UseMaintenanceWindow' only within 'OldResourceProperties'

"ResourceProperties": {
        "ServiceToken": "arn:aws:lambda:eu-central-1:123123123:function:xyz-Instance-Scheduler-v140-InstanceSchedulerMain",
        "Timezone": "Europe/Berlin",
        "StopNewInstances": "false",
        "Periods": [
            {
                "WeekDays": "Mon-Sun",
                "Description": "Schedule for RDS Backup",
                "EndTime": "03:10",
                "BeginTime": "00:00"
            },
            {
                "WeekDays": "Mon-Fri",
                "Description": "Period 1",
                "EndTime": "10:00",
                "BeginTime": "09:00"
            }
        ],
        "Description": "Specific Time Window for Application: jean",
        "Enforced": "False",
        "Name": "jean-SpecificDefinitionRDS-3",
        "NoStackPrefix": "True"
    },
    "OldResourceProperties": {
        "ServiceToken": "arn:aws:lambda:eu-central-1:123123123:function:xyz-Instance-Scheduler-v140-InstanceSchedulerMain",
        "Timezone": "Europe/Berlin",
        "StopNewInstances": "false",
        "UseMaintenanceWindow": "True",
        "Periods": [
            {
                "WeekDays": "Mon-Sun",
                "Description": "Schedule for RDS Backup",
                "EndTime": "03:10",
                "BeginTime": "00:00"
            },
            {
                "WeekDays": "Mon-Fri",
                "Description": "Period 1",
                "EndTime": "10:00",
                "BeginTime": "09:00"
            }
        ],
        "Description": "Specific Time Window for Application:  jean",
        "Enforced": "False",
        "Name": "jean-SpecificDefinitionRDS-3",
        "NoStackPrefix": "True"
    }

Additional context Add any other context about the problem here.

CrypticCabub commented 1 month ago

Thanks for reporting this. This is indeed a bug in the 3.0.x release of Instance Scheduler and will be fixed in our next patch release

CrypticCabub commented 1 month ago

Fixed in v3.0.2