Skip to content
This repository has been archived by the owner on Jun 15, 2023. It is now read-only.

How to define input path when there is a space? #3

Closed
davidclin opened this issue Jul 10, 2018 · 1 comment
Closed

How to define input path when there is a space? #3

davidclin opened this issue Jul 10, 2018 · 1 comment

Comments

@davidclin
Copy link

davidclin commented Jul 10, 2018

Hi,

I want to pass Limit Amount and Current Usage as variables into an SNS topic.

Can this be done?

Below is a CloudWatch event from Trusted Advisor that contains these values I want to transform into human readable output:

{
  "version":"0",
  "id":"eda2dd4a-81df-d688-5f19-ef642ad7b486",
  "detail-type":"Trusted Advisor Check Item Refresh Notification",
  "source":"aws.trustedadvisor",
  "account":"929292782238",
  "time":"2018-07-10T01:06:15Z",
  "region":"us-east-1",
  "resources":[],
  "detail":{
    "check-name":"VPC Network Interfaces",
    "check-item-detail":{
        "Status":"Red",
        "Current Usage":"5",
        "Limit Name":"VPCs",
        "Region":"us-west-2",
        "Service":"VPC",
        "Limit Amount":"5"},
      "status":"ERROR",
      "resource_id":"",
      "uuid":"9ae2b76d-2a13-4174-9bd1-b8acfc381767"
  }
}

I have tried the following Input Path but get an invalid input path error:

{"service" : "$.detail.Service", "usage" : "$.detail.check-item-detail.Current Usage", "limit_amount" : "$.detail.Limit Amount"}
@davidclin
Copy link
Author

davidclin commented Jul 10, 2018

I figured out what I was doing wrong while I was editing the JSON output above.

The following input path now works:

{"check-name":"$.detail.check-name","check-item-detail":"$.detail.check-item-detail"}

Instead of grabbing specific values that contain spaces (i.e. Limit Amount), I decided it was better to grab the entire output of $.detail.check-item-detail.

Just for context, I am using the AWS Service Limit Monitor which passes Trusted Advisor events to CloudWatch to an SNS topic in JSON. Since the JSON format in the email notification is not human readable I wanted to use this SNS Input Transformer to make the notification more consumable without having to write/modify a Lambda. This SNS Input Transformer is perfect for my needs and has solved my problem.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant