Instructions to Export Usage Data
10 min
jobs to export data can be configured by calling the jobs api api endpoints method endpoint description get https //app amberflo io/jobs list all jobs get https //app amberflo io/jobs/{id} get a job by id post https //app amberflo io/jobs create a job put https //app amberflo io/jobs update a job delete https //app amberflo io/jobs/{id} delete a job by id post https //app amberflo io/jobs/check validate a job without creating all endpoints require the x api key header for authentication required fields field description jobname unique name (alphanumeric, hyphens, spaces, commas, parentheses only) s3url s3 bucket/path where exported data will be written format output format json , csv , or ndjson aggregationbucket time granularity hour , day , week , or month range lookback window in format ago(#x) where # is a positive integer and x is d (days), h (hours), or m (minutes) example ago(7d) scheduling (pick one) field description cron standard 5 field cron expression for recurring execution (e g /5 ) scheduledtimeinseconds unix epoch timestamp (seconds) for a one off execution see https //crontab guru/ https //crontab guru/ for constructing cron expression note cron and scheduledtimeinseconds are mutually exclusive provide one or neither optional fields field default description description null human readable description email null notification email address enabled true whether the job is active sparse true return sparse query results minimizefresh true minimize fresh data in results endtimeoffset null end time offset in ago(#x) format meterapinames null array of meter api names to query groupby null array of dimensions to group by filter null object mapping dimension names to arrays of allowed values rescalefunction null object with function ( multiply ) and coefficient (number) create a job curl x post https //app amberflo io/jobs \\ h "content type application/json" \\ h "x api key \<your api key>" \\ d '{ "jobname" "daily export", "s3url" "my usage bucket", "format" "csv", "aggregationbucket" "day", "range" "ago(7d)", "cron" "0 2 ", "enabled" true, "meterapinames" \["api calls", "storage"], "groupby" \["customer id"], "filter" { "region" \["us east 1", "eu west 1"] } }' update a job curl x put https //app amberflo io/jobs \\ h "content type application/json" \\ h "x api key \<your api key>" \\ d '{ "id" "\<job id>", "jobname" "daily export", "s3url" "my usage bucket", "format" "csv", "aggregationbucket" "day", "range" "ago(7d)", "cron" "0 3 ", "enabled" true }' delete a job curl x delete https //app amberflo io/jobs/\<job id> \\ h "x api key \<your api key>" validate a job (dry run) curl x post https //app amberflo io/jobs/check \\ h "content type application/json" \\ h "x api key \<your api key>" \\ d '{ "jobname" "daily export", "s3url" "my usage bucket", "format" "csv", "aggregationbucket" "day", "range" "ago(7d)", "cron" "0 2 " }' validation use post /jobs/check to validate a job configuration without creating it it returns the validated job and the query that would be built s3 bucket permissions the user must grant amberflo cross account write access to their s3 bucket the only permission required is s3\ putobject add a bucket policy like { "version" "2012 10 17", "statement" \[ { "effect" "allow", "principal" { "aws" "arn\ aws\ iam \<amberflo account id>\ root" }, "action" "s3\ putobject", "resource" "arn\ aws\ s3 \<customer bucket>/ ", "condition" { "stringequals" { "s3\ x amz acl" "bucket owner full control" } } } ] } objects are written with the bucket owner full control acl so the customer retains full ownership of the files in their bucket no read, list, or delete permissions are needed