Last active
August 26, 2015 12:33
-
-
Save AshCoolman/4a40ce8fb2ddf0df2547 to your computer and use it in GitHub Desktop.
Tell slack when your AWS instance has restarted
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Tell slack when your AWS instance has restarted | |
# | |
# 1. Replace the slack service hook (or entire script from `curl -X POST...`) | |
# 2. Put this file in your .ebextensions folder called tell_slack.config | |
# | |
# .ebextensions/ | |
# └── tell_slack.config | |
# | |
# On your deployed server tell_slack.sh should be AUTOMATICALLY generated in /opt/elasticbeanstalk/hooks/appdeploy/post | |
# | |
# NOTICE: This example has Slack posting into the #general channel, you probably want to change it lest you spam your workmates | |
commands: | |
create_post_dir: | |
command: "mkdir /opt/elasticbeanstalk/hooks/appdeploy/post" | |
ignoreErrors: true | |
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/tell_slack.sh": | |
mode: "000755" | |
owner: root | |
group: root | |
content: | | |
#!/usr/bin/env bash | |
/var/app/current | |
curl -X POST --data-urlencode "payload={\"channel\": \"#general\", \"username\": \"AWS\", \"text\": \"\nEB post install completed\", \"icon_emoji\": \":mega:\"}" https://hooks.slack.com/services/XXXXXXX/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment