utility

AWS CLI

External AWS CLI; explicit profile and region select configuration but do not prove identity. Validate account and status before authorized operations. Example executes only ./mock/aws, not the real CLI. No version verified.

Formal Syntax & Structure

bash syntaxbash
aws --profile PROFILE --region REGION --output json SERVICE OPERATION

Return Value

exit status

External AWS CLI; explicit profile and region select configuration but do not prove identity. Validate account and status before authorized operations. Example executes only ./mock/aws, not the real CLI. No version verified.

Working Example

Example Snippetbash
mkdir mockcat > mock/aws <<'MOCK'#!/bin/bashexpected=(--profile lab --region eu-west-1 --output json sts get-caller-identity)[[ $# == ${#expected[@]} ]] || exit 2for x in "${expected[@]}"; do [[ $1 == "$x" ]] || exit 2; shift; doneprintf '{"Account":"000000000000"}\n'MOCKchmod 700 mock/awsargs=(--profile lab --region eu-west-1 --output json sts get-caller-identity)result=$(./mock/aws "${args[@]}") || exit 1jq -e '.Account == "000000000000"' <<< "$result"
Bash Reference