Syntax error with os module while using pipe delimeter with jq commnad

I am using aws-cli command within python os module, while using jq and output redirection i am getting an error .

Error:

SyntaxError: invalid syntax

code:

iport os
os.system('aws ce get-cost-and-usage --profile dev --time-period Start=2022-10-01,End=2022-10-31 + 1 month  - 1 second" -I) --granularity MONTHLY --metrics USAGE_QUANTITY BLENDED_COST  --group-by Type=DIMENSION,Key=SERVICE | /bin/jq  '[ .ResultsByTime[].Groups[] | select(.Metrics.BlendedCost.Amount > "0") | { (.Keys[0]): .Metrics.BlendedCost } ] | sort_by(.Amount)| add' > /tmp/cost.json')

Is there a way to fix it, please let me know.



Comments

Popular posts from this blog

Today Walkin 14th-Sept

Hibernate Search - Elasticsearch with JSON manipulation

Spring Elasticsearch Operations