okigan / awscurl

curl-like access to AWS resources with AWS Signature Version 4 request signing.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Can you show an example of calling aws curl from using the docker container that returns an error code to the calling process please?

preetmyob opened this issue · comments

Scenario: I'm running awscurl to validate that I've deployed my APIs correctly and that have a simple version endpoint that should return some info if called with a GET

docker run --rm \
    -ti \
    -v "$HOME/.aws:/root/.aws" \
    -e AWS_ACCESS_KEY_ID \
    -e AWS_SECRET_ACCESS_KEY \
    -e AWS_SECURITY_TOKEN \
    -e AWS_PROFILE \
    -e AWS_REGION \
    "okigan/awscurl:$image_version" \
    https://some-domain/api/servicename/version

Problem: I don't know how to get an error code if the domain return something other than 200.

Solution: I'd like to get either a binary passed/failed, or more ideally the status code of the call

It's ok I've worked it out:

you can use

docker container inspect nnnn --format={{.State.ExitCode}} where nnnn is the exited container id, or just use the exit code from bash echo $?