Files
oam/knowledge base/cloud computing/aws/awscurl.md
2024-05-02 02:01:38 +02:00

1.6 KiB

awscurl

curl-like tool with AWS Signature Version 4 request signing.

  1. TL;DR
  2. Further readings
    1. Sources

TL;DR

Installation
brew install 'awscurl'
Usage
# Credentials are inferred from the default profile if none is given.
awscurl -X 'POST' --region 'eu-south-1' --service 'aps' \
  'https://aps.workspace.url/api/v1/query?query=up'
awscurl … --profile 'work'
awscurl … --access_key 'access-key-id' --secret_key 'secret-key'

# Set query data out of the URL.
awscurl … 'https://aps.workspace.url/api/v1/query/api/v1/query' \
  -d 'query=up' -d 'time=1652382537' -d 'stats=all'
awscurl … 'https://aps.workspace.url/api/v1/query/api/v1/query_range' \
  -d 'query=sum+%28rate+%28go_gc_duration_seconds_count%5B1m%5D%29%29' \
  -d 'start=1652382537' -d 'end=1652384705' -d 'step=1000' -d 'stats=all'

# Run in containers.
docker run --rm -it 'okigan/awscurl' \
  --region 'eu-south-1' --service 'aps' \
  --access_key "$AWS_ACCESS_KEY_ID" --secret_key "$AWS_SECRET_ACCESS_KEY" \
  'https://aps.workspace.url/api/v1/query/api/v1/query?query=up'

Further readings

Sources