aws-dx-monitor monitors AWS Direct Connect runtime configuration items with Amazon CloudWatch. The system is driven by Amazon CloudWatch Events and AWS Lambda.
The following diagram expresses the high level system execution architecture.
- CloudWatch Events schedules and invokes the Lambda function at one minute intervals.
- The Lambda function interrogates the AWS Direct Connect service through Describe API calls for every configuration type that makes sense for its operational scope (for example, if you are a Service Provider, you may wish to describe the Interconnects). AWS Direct Connect responds with the JSON payloads for each Describe call.
- After the Lambda function extracts the status from a given configuration item, it puts the data to a CloudWatch Custom Metric. Each configuration item type should have its own dimension in order to easily identify what is being monitored.
- Once the data has been settled in the custom CloudWatch metric, you can set alarms for it. See the section on Status Levels for information on configuration item status levels.
- Alarms may be triggered to notify an operator or administrator of a monitored status threshold.
Use the following steps to build and deploy the system. It is strongly suggested that you review the security policies prior to deploying to your environment.
On the system where you will be building the AWS Lambda package, you will need the following:
- git
- Python 3.8
- AWS CLI (for creating S3 bucket)
- AWS Serverless Application Model (SAM). Please follow the SAM installation instructions, they will not be replicated here.
Clone this repository.
$ git clone https://github.com/awslabs/aws-dx-monitor
The staging bucket is required to store the SAM deployment artifacts. The name I chose for my s3 bucket is rpcme-dx-monitor
aws s3api create-bucket --bucket rpcme-dx-monitor
Validate, build, and deploy the aws-dx-monitor package.
cd aws-dx-monitor
sam validate
sam build
sam deploy --region us-west-1 \
--stack-name dx-monitor \
--s3-bucket rpcme-dx-monitor \
--capabilities CAPABILITY_IAM
Once the scheduled event begins sending data to Amazon CloudWatch, you can begin setting alarms. The custom metric will be found in CloudWatch > Metrics under the name AWSx/DirectConnect. For more information, see Creating Amazon CloudWatch Alarms.
You may wish to alarm on these levels:
Config Item | Level |
---|---|
Connection | >= 5 |
Interconnect | >= 4 |
Connections on Interconnect | >= 5 |
Virtual Interface | >= 5 |
Virtual Gateway | >= 3 |
See the following sections for status levels on:
- Connections
- Interconnects
- Connections on Interconnects
- Virtual Interfaces
- Virtual Gateways
Name | API Status Value | Numeric Value |
---|---|---|
Ordering | ordering | 1 |
Requested | requested | 2 |
Pending | pending | 3 |
Available | available | 4 |
Down | down | 5 |
Deleting | deleting | 6 |
Deleted | deleted | 7 |
Rejected | rejected | 8 |
Name | API Status Value | Numeric Value |
---|---|---|
Requested | requested | 1 |
Pending | pending | 2 |
Available | available | 3 |
Down | down | 4 |
Deleting | deleting | 5 |
Deleted | deleted | 6 |
Name | API Status Value | Numeric Value |
---|---|---|
Ordering | ordering | 1 |
Requested | requested | 2 |
Pending | pending | 3 |
Available | available | 4 |
Down | down | 5 |
Deleted | deleted | 6 |
Rejected | rejected | 7 |
Name | API Status Value | Numeric Value |
---|---|---|
Confirming | confirming | 1 |
Verifying | verifying | 2 |
Pending | pending | 3 |
Available | available | 4 |
Down | down | 5 |
Deleting | deleting | 6 |
Deleted | deleted | 7 |
Rejected | rejected | 8 |
Testing | testing | 9 |
Name | API Status Value | Numeric Value |
---|---|---|
Pending | pending | 1 |
Available | available | 2 |
Deleting | deleting | 3 |
Deleted | deleted | 4 |
To delete the sample application that you created, use the AWS CLI. Assuming you used your project name for the stack name, you can run the following:
aws --region us-west-1 cloudformation delete-stack --stack-name dx-monitor
See the AWS SAM developer guide for an introduction to SAM specification, the SAM CLI, and serverless application concepts.
Next, you can use AWS Serverless Application Repository to deploy ready to use Apps that go beyond hello world samples and learn how authors developed their applications: AWS Serverless Application Repository main page