Expand description
AWS, through the AWS CLI: who an account’s credentials are, the CLI’s profiles, this month’s spend (Cost Explorer), and whether the account may create EC2 instances (a dry run, which creates nothing). An account signs in with the CLI’s own credentials (its default chain, or a profile), or with an access key, given to the CLI’s official container (Docker is all that needs).
Structs§
- Account
- An AWS account: its credentials, and the region asked.
Enums§
- Credentials
- Where an account’s credentials come from.
- Launch
Permission - Whether the account may create EC2 instances, as a dry run of one said.
Constants§
- CLI
- The AWS CLI.
- CLI_
IMAGE - The AWS CLI’s official image, which runs a call made with an access key.
- IMAGE_
TIMEOUT - How long a call in
CLI_IMAGEmay take: the first one pulls the image. - LATEST_
AMAZON_ LINUX - The SSM public parameter naming the latest Amazon Linux 2023 image (
x86_64, forPROBE_INSTANCE_TYPE) in the account’s region: a real, public image the dry run is checked against. - PROBE_
INSTANCE_ TYPE - The instance type the launch permission is dry-run with.
- UNKNOWN_
IMAGE - A well-formed image id no account has: AWS answers it with
InvalidAMIID.NotFound, which it only says once the request is authorized. Used when the public parameter can’t be read (ssm:GetParameterdenied, SSM unreachable). Not a 17-character made-up id: AWS reads those as malformed before it looks at the permission at all. - WHO_
AM_ I - The question whose answer is who an account’s credentials are, the identity’s ARN: the one that tells its sign-in still holds.
Functions§
- before_
authorization - Whether AWS raises error
codebefore it authorizes a request, so it says nothing of the permission: bad or expired credentials, throttling, a malformed or missing parameter, AWS itself, an account not yet usable. Every other code comes after authorization. - error_
code - The error code of a failed AWS CLI call:
Codein “An error occurred (Code) when calling…”. - identity
- Who
account’s credentials are (WHO_AM_I): the identity’s ARN. - launch_
permission - Dry-runs creating a
PROBE_INSTANCE_TYPEfrom the region’s latest Amazon Linux image (LATEST_AMAZON_LINUX, elseUNKNOWN_IMAGE): creates nothing, and tells whether the account may create instances. - month_
to_ date_ cost account’s spend this month so far, in USD, as Cost Explorer has it (unblended).- profiles
- The profiles the host’s AWS CLI has (
aws configure list-profiles), in its order. - refusal
- How the AWS CLI refused, read from what it said: a sign-in run out or missing, or keys rejected (the runner’s reading of an expired sign-in, and the CLI’s own words), Cost Explorer not enabled, a permission denied.