This CDK instance deploys the bot in an EC2 instance. This is a summary of what it does:
- Create a user and access keys for that user
- Create a DynamoDB table called
subscriptions
. - Grant the user permissions to access the subscriptions table
- Create an EC2 instance (t2.micro), with the port 22 open using the key
bot-ssh-key
- Pass the keys for the user to .aws/credentials
- Run the set up files, which installs dependencies and the bot, and runs it permanently.
The AWS CLI and AWS CDK must be installed. You can refer to this guide to install and configure the CLI and this guide to install the CDK.
The Discord application token must be exported as BOT_TOKEN
: export BOT_TOKEN=b32...
.
You can generate an application token from the Discord developer portal.
You also need an SSH key to access the server called bot-ssh-key
. This is so you can access the server later on. See a guide here
Once you have the cdk installed, the token exported and the key created, you can run cdk deploy
.
npm run build
compile typescript to jsnpm run watch
watch for changes and compilenpm run test
perform the jest unit testscdk deploy
deploy this stack to your default AWS account/regioncdk diff
compare deployed stack with current statecdk synth
emits the synthesized CloudFormation template