This example project uses Cloud Elements Serverless Framework Plugin
to fetch information about a formula instance, feed that to AWS CloudWatch, create a dashboard, and create and alarm.
Information about the package can be found at Cloud Elements Serverless Framework
- Clone this repo
- Update serverless.yml
- Set up your environment
- AWS Permissions
- Deploy
- Observe
Without changing anything your dashboard with be named after your insance with -dashboard
appended
If your formula instance id is 12314
the dashboard will be named 12314-dashboard
To change the name of the dashboard follow the instructions below:
The field to change can be found on line 37 of the yaml or at resources.Resources.dashboard.Properties.DashboardName
To add email addresses to the notificaiton subscription at this point enter your email address(es) on line 100 or at resources.Resources.alarmNotificationSNSTopic.Properties.Subscription.Endpoint
If you don't want to add any email notifications at this moment remove the subscription (lines 99-101)
You need to generate or use an AWS key and secret. There are several ways to set this up but a simple way is:
$ serverless config credentials --provider aws --key <your key here> --secret <your secret here>
There are 4 variables to set:
- USER_TOKEN
- ORG_TOKEN
- BASE_URL
- FORMULA_INSTANCE_ID
- FORMULA_INSTANCE_NAME
An example of setting an env variable
$ export BASE_URL="https://api.cloud-elements.com"
Please note that it is the formula instance id and name and not the formula template id/name
While this is not the the minimal permissions set needed from AWS these are what our users are configured for and therefore if your user has these there should be no issue deploying formula monitor
- AmazonSQSFullAccess
- AWSLambdaFullAccess
- AmazonS3FullAccess
- AmazonAPIGatewayInvokeFullAccess
- CloudWatchFullAccess
- AmazonDynamoDBFullAccess
- AmazonAPIGatewayAdministrator
- AmazonSNSFullAccess
{
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:PutRolePolicy",
"iam:DeleteRolePolicy",
"iam:CreateRole",
"iam:DeleteRole"
],
"Resource": [
"arn:aws:iam::*:role/*"
]
},
{
"Effect": "Allow",
"Action": [
"cloudformation:*"
],
"Resource": [
"*"
]
}
]
}
$ npm install
$ sls deploy
Navigate to the dashboard in AWS CloudWatch!