Documentation
¶
Overview ¶
Package awsx holds the tiny shared AWS plumbing for Otium's provider sources: how to resolve credentials and build per-region EC2 clients. It exists so pkg/pricing/aws and pkg/inventory/aws don't each reinvent client construction.
Credentials are supplied explicitly via WithStaticCredentials — the per-identity OTIUM_AWS_*_ACCESS_KEY / _SECRET_KEY a caller reads from config (a read-only pricing user for otium-ops, a write provisioning user for otium-scheduler). When none are given it falls back to the AWS default credential chain (SSO profile in local dev, instance role in production), so an unset pair is a no-op. See docs/pricing-indexer.md.
Index ¶
Constants ¶
const PricingRegion = "us-east-1"
PricingRegion is the region the AWS Price List Query API is pinned to. The service is global but reachable only from a few regions; us-east-1 is the canonical one. On-demand prices are region-level data carried in the response regardless of this client region.
Variables ¶
This section is empty.
Functions ¶
func EC2 ¶
EC2 builds an EC2 client from cfg pinned to region (overriding cfg's default region). Spot prices are region-scoped, so the per-region sources build one client each.
func LoadConfig ¶
LoadConfig resolves AWS configuration. region sets the default region for clients derived from the returned config; pass "" to defer to the environment/profile default. Credentials come from WithStaticCredentials when supplied, otherwise the AWS default credential chain.
Types ¶
type Option ¶
type Option func(*loadOptions)
Option configures LoadConfig.
func WithStaticCredentials ¶
WithStaticCredentials supplies an explicit AWS access key + secret. When BOTH are non-empty LoadConfig uses them (a static credentials provider) instead of the default credential chain; when either is empty the option is a no-op and the chain resolves credentials. IAM-user keys carry no session token, so none is passed.