Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/chetan/aws-sqs-restart
https://github.com/chetan/aws-sqs-restart
Last synced: 21 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/chetan/aws-sqs-restart
- Owner: chetan
- Created: 2014-06-03T15:17:04.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2014-06-03T15:17:16.000Z (over 10 years ago)
- Last Synced: 2024-10-19T03:45:12.065Z (2 months ago)
- Language: Ruby
- Size: 105 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# aws-sqs-restart
A simple daemon for restarting EC2 instances via CloudWatch alarms published
to SQS.### Install
```
$ git clone https://github.com/chetan/aws-sqs-restart.git
$ cd aws-sqs-restart
$ bundle install
```### Configure
You must export the following environment variables (or add them to the
command line):* AWS_ACCESS_KEY_ID
* AWS_SECRET_ACCESS_KEY
* AWS_QUEUE_NAME
* AWS_TOPIC_ARN (optional)If AWS_TOPIC_ARN is available, then the given topic will be notified of the
restart event. The message body will be as in the sample below.### AWS Setup
The following steps are required to setup a CloudWatch alarm to publish through
to SQS:* Create a new SQS queue
* Create a new SNS topic and [point it to SQS](http://docs.aws.amazon.com/sns/latest/dg/SendMessageToSQS.html)
* Create a new CloudWatch alarm and select the new SNS topic### Run
```
$ ./daemon.rb
or
$ ./daemon.rb 2>&1 >restart.log &
```### Sample output
```
$ ./daemon.rb
Listening on SQS queue 'hang-restart-test' for alarm events...
-> received alarm at 2013-10-09 18:53:39 UTC
alarm published at 2013-10-09 18:53:38 UTC
reason: Threshold Crossed: 1 datapoint (100.0) was greater than or equal to the threshold (90.0).
telling i-a1b2c3d4 to reboot
```