I hate to put binaries into git, but they need to be zips to send up to lambda. I could conceivably do all of this via terraform's "archive_file" data type (it's useful for lambda deployments!), but it complicates things and hopefully the changes to these binaries are a very rare thing.
The lambda function to start/stop instances in test
Method used to create govcloud version:
Download the lambda distribution package:
aws s3 cp s3://aws-instance-scheduler/latest/instance-scheduler-2.2.2.0.zip . --profile mdr-common-services
Unzip it.
mkdir tmp
cd tmp
unzip ../instance-scheduler-2.2.2.0.zip
Modify schedulers/instance_scheduler.py
:
Line 91 used go be:
self._valid_regions = boto3.Session().get_available_regions(service.service_name)
Change it to:
self._valid_regions = boto3.Session().get_available_regions(service=service.service_name, partition='aws-us-gov')
Zip it back up:
zip -r ../instance-scheduler.aws-us-gov.zip *