项目作者: retgits

项目描述 :
An AWS Lambda app to create events in Wavefront, based on CloudFormation events
高级语言: Go
项目地址: git://github.com/retgits/wavefront-cf-notifier.git
创建时间: 2019-08-14T18:32:35Z
项目社区:https://github.com/retgits/wavefront-cf-notifier

开源协议:MIT License

下载


wavefront-cf-notifier

If you’re using AWS services, changes are you’re using AWS CloudFormation to deploy new apps into production. If you’re also using Wavefront to monitor your AWS resources, you can use this Lambda app to automatically create events in Wavefront so you can overlay those events on your dashboards.

  1. .
  2. ├── LICENSE <-- Because everything needs a license
  3. ├── Makefile <-- Make to automate build
  4. ├── README.md <-- This file
  5. ├── go.mod <-- Go modules file
  6. ├── go.sum <-- Go sum file
  7. ├── main.go <-- Lambda function code
  8. ├── main_test.go <-- Unit tests
  9. ├── template.yaml <-- SAM template
  10. └── test
  11. └── snsevent.json <-- Sample event used to test the function locally

Dependencies

To use this app, you’ll need to have a few things ready:

Building the app

Getting the Go modules

To get the Go modules needed to build the app, run

  1. # Use a proxy for repeatable builds, this example uses GoCenter
  2. export GOPROXY=https://gocenter.io
  3. make deps

or, if you don’t want to use make

  1. export GOPROXY=https://gocenter.io
  2. go get ./...

Building an executable

AWS Lambda takes a compiled executable to deploy, so you can run

  1. make build

or, if you don’t want to use make

  1. GOOS=linux GOARCH=amd64 go build -o ./dist/wavefront-cf-notifier

Deploying to AWS Lambda

Before you can deploy the app, you’ll need to update the template.yaml file in three places:

  • Line 26 should be updated with the ARN of your SNS topic
  • Line 33 should be updated to your correct API endpoint for Wavefront
  • Line 34 should be updated with your Wavefront API token

Once those are configured, you can run

  1. # Package your Lambda app and upload to S3
  2. make package
  3. # Create a Cloudformation Stack and deploy your SAM resources
  4. make deploy

or, if you don’t want to use make

  1. # Package your Lambda app and upload to S3
  2. sam package \
  3. --output-template-file packaged.yaml \
  4. --s3-bucket <name of your S3 bucket>
  5. # Create a Cloudformation Stack and deploy your SAM resources
  6. sam deploy \
  7. --template-file packaged.yaml \
  8. --stack-name wavefront-cf-notifier \
  9. --capabilities CAPABILITY_IAM

All Make targets

  1. $ make
  2. Usage: make [TARGET]
  3. Makefile targets
  4. build Build the executable
  5. clean Removes all generated code
  6. deploy Create a Cloudformation Stack and deploy your SAM resources
  7. deps Get the dependencies for this project.
  8. help Displays the help for each target (this message).
  9. package Package your Lambda app and upload to S3
  10. samtest Runs SAM local
  11. test Runs go test -cover

License

This Lambda app is provided under the MIT license.