awscreds

package
v0.0.0-...-2fd5d2c Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 14, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Overview

Package awscreds resolves database credentials on AWS: Secrets Manager for stored credentials, RDS IAM for short-lived tokens.

It is the AWS implementation of dbconn.CredentialSource. A provider added later supplies its own, and nothing above this line changes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegionFromARN

func RegionFromARN(arn string) string

RegionFromARN extracts the region from an ARN (arn:aws:secretsmanager:<region>:<account>:secret:<name>).

Types

type Secret

type Secret struct {
	Username string      `json:"username"`
	Password string      `json:"password"`
	Host     string      `json:"host"`
	Port     json.Number `json:"port"`
	DBName   string      `json:"dbname"`
}

Secret is the credential JSON in a Secrets Manager secret.

RDS-managed secrets carry the full connection detail, where the secrets Celerity generates carry username and password only. Connection detail is parsed but treated as a fallback, because an endpoint derived from deployed state points at the proxy while the secret names the database behind it.

func FetchSecret

func FetchSecret(ctx context.Context, secretARN string) (*Secret, error)

FetchSecret reads and parses a Secrets Manager secret, including the connection detail an RDS-managed secret carries.

The region comes from the ARN so this works from a machine whose default region is somewhere else, which is the normal case for an operator with several environments.

type Source

type Source struct{}

Source resolves credentials from Secrets Manager and RDS IAM.

func New

func New() *Source

New returns the AWS credential source.

func (*Source) Resolve

func (s *Source) Resolve(ctx context.Context, reference string) (dbconn.Credentials, error)

Resolve reads a credential from Secrets Manager. The reference is a secret ARN or name.

func (*Source) Token

func (s *Source) Token(
	ctx context.Context,
	endpoint dbconn.Endpoint,
	user string,
	region string,
) (dbconn.Credentials, error)

Token builds a short-lived RDS IAM authentication token to use in place of a password.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL