Skip to content

Commit

Permalink
Add put config script. This doesn't work because the Cloudformation s…
Browse files Browse the repository at this point in the history
…cript doesn't export the DynamoDB tables. Add Pagerduty schedule ID/slack ID manually to the DynamoDB talbe for now.
  • Loading branch information
djagannath-asapp committed Jul 27, 2019
1 parent 40455c5 commit 7de2e0b
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions scripts/put-config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/usr/bin/env bash

# Quick script to assist with dynamodb config
STACKNAME_BASE=$(grep -E -o -m 1 '"([^"]*)"' ./Makefile | sed 's/"//g')
TABLE_NAME=$(aws cloudformation list-exports |grep -E -o "$STACKNAME_BASE-ConfigTable-.*?" | sed 's/",//g')

read -sp "Pagerduty schedule ID (PXXXXX): " schedule; echo
read -sp "Slack channel (CXXXXXXXX): " slack; echo

# build dynamodb json. variable handling makes it janky
read -r -d '' TABLE_ITEM << EOM
{
"schedule": "$schedule",
"slack": "$slack"
}
EOM
echo $STACKNAME_BASE
echo $TABLE_ITEM

# update dynamodb table
aws dynamodb put-item --table-name $TABLE_NAME --item "$TABLE_ITEM"

0 comments on commit 7de2e0b

Please sign in to comment.