Skip to main content

A CDK construct that will automatically start a stopped EC2 instance at a given time.

Project description

Wakeywakey!

Do you have a EC2 instance that you only need during certain hours of the day? Do you want to reduce it's cost? Are you using the @matthewbonig/nightynight construct to shut it down every night? Do you want to start it up in the morning?

That's the Wakeywakey construct. It's very simple. Give it an instanceId and it will create a Lambda and a CloudWatch Event Rule to fire the lambda at a specific time of day. If the instance is stopped, it is started.

This is a pre-release!

This is a quick first-draft. All the options that will likely need to be added to accomodate a large number of use-cases are still needed. If you'd like to make requests or help update this construct, please open an Issue or a PR.

What is creates

arch.png

  • A Rule that will, on a given schedule, fire a lambda.
  • A Lambda with permissions to describe ec2 instances. It will read the instance by the given instanceId and then start the instance if it's in a stopped state.

Example:

# Example automatically generated without compilation. See https://github.com/aws/jsii/issues/826
class WakeyWakeyStack(Stack):

    def __init__(self, scope, id, props):
        super().__init__(scope, id, props)

        # The code that defines your stack goes here
        WakeyWakey(self, "wakeywakey", instance_id="i-123123123123")

This will start the instance with id i-123123123123 at (the default) 4am GMT.

Contributing

Please open Pull Requests and Issues on the Github Repo.

License

MIT

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mbonig.wakeywakey-1.89.2.tar.gz (48.8 kB view details)

Uploaded Source

Built Distribution

mbonig.wakeywakey-1.89.2-py3-none-any.whl (47.6 kB view details)

Uploaded Python 3

File details

Details for the file mbonig.wakeywakey-1.89.2.tar.gz.

File metadata

  • Download URL: mbonig.wakeywakey-1.89.2.tar.gz
  • Upload date:
  • Size: 48.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for mbonig.wakeywakey-1.89.2.tar.gz
Algorithm Hash digest
SHA256 3b2525a7ef7885a9d489a08f9ea8cdb4e5baee2bc155dfc717097fd4125645ee
MD5 4a5752dafa0dda1edce89efd7b00d853
BLAKE2b-256 103c4dda6cea215a15ba3b6c4c064cb37375a5736cc115b47f2cdd1c9b796c25

See more details on using hashes here.

File details

Details for the file mbonig.wakeywakey-1.89.2-py3-none-any.whl.

File metadata

  • Download URL: mbonig.wakeywakey-1.89.2-py3-none-any.whl
  • Upload date:
  • Size: 47.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/41.6.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.7.5

File hashes

Hashes for mbonig.wakeywakey-1.89.2-py3-none-any.whl
Algorithm Hash digest
SHA256 43cc2a8cd1d344a07209556381667ff078a33956660c9e9b6c1099cca3ed29cd
MD5 cd7552074f255028ced5aaa8cc84d401
BLAKE2b-256 71645044a45d4fff458064660f36aa889d1f2aba734c28505459b14af62173ec

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page