Skip to main content

Module aws

Module aws 

Source
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.
LaunchPermission
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_IMAGE may take: the first one pulls the image.
LATEST_AMAZON_LINUX
The SSM public parameter naming the latest Amazon Linux 2023 image (x86_64, for PROBE_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:GetParameter denied, 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 code before 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: Code in “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_TYPE from the region’s latest Amazon Linux image (LATEST_AMAZON_LINUX, else UNKNOWN_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.