Skip to content

Instantly share code, notes, and snippets.

@AshCoolman
Last active August 26, 2015 12:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AshCoolman/4a40ce8fb2ddf0df2547 to your computer and use it in GitHub Desktop.
Save AshCoolman/4a40ce8fb2ddf0df2547 to your computer and use it in GitHub Desktop.
Tell slack when your AWS instance has restarted
# 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