awsssm

package
v1.7.1 Latest Latest
Warning

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

Go to latest
Published: Aug 22, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package awsssm provides an AWS Systems Manager Parameter Store provider.

AWS SSM Parameter Store is a hierarchical configuration store. It's commonly used for storing configuration parameters, secrets, and other data that applications need at runtime.

Key Differences from AWS Secrets Manager (awssm)

  • Hierarchical paths: Parameters are organized in paths like /myapp/prod/DB_HOST
  • Parameter types: String, StringList, and SecureString (encrypted)
  • Free tier: Standard parameters are free, making it cost-effective
  • Path-based retrieval: Can fetch all parameters under a path prefix

Setting up the environment

Flags (not recommended):

configurer l awsssm \
  --region         "us-east-1" \
  --path           "/myapp/prod" \
  --profile        "default" -- env

Or for a single parameter:

configurer l awsssm \
  --region         "us-east-1" \
  --parameter-name "/myapp/prod/DB_HOST" \
  --profile        "default" -- env

Environment Variables (recommended):

export AWS_REGION="us-east-1"
export AWS_PROFILE="default"
export AWSSSM_PATH="/myapp/prod"

configurer l awsssm -- env

Index

Constants

View Source
const Name = "awsssm"

Name of the provider.

Variables

This section is empty.

Functions

func New

func New(
	override, rawValue bool,
	config *Config,
	paramInfo *ParameterInformation,
) (provider.IProvider, error)

New creates a new AWS SSM Parameter Store provider.

The following environment variables can be used to configure the provider:

  • AWS_REGION: The AWS region where parameters are stored.
  • AWS_PROFILE: The AWS profile to use for authentication.
  • AWS_ACCESS_KEY_ID: The AWS access key ID (not recommended, use IAM roles instead).
  • AWS_SECRET_ACCESS_KEY: The AWS secret access key (not recommended, use IAM roles instead).
  • AWSSSM_PATH: The parameter path prefix to load.
  • AWSSSM_PARAMETER_NAME: A specific parameter name to load.

NOTE: It's recommended to use IAM roles for authentication instead of access keys.

func NewWithConfig

func NewWithConfig(
	override, rawValue bool,
	config *Config,
	paramInfo *ParameterInformation,
	awsConfig aws.Config,
) (provider.IProvider, error)

NewWithConfig creates a new AWS SSM Parameter Store provider with custom AWS configuration.

Types

type AWSSSM

type AWSSSM struct {
	*provider.Provider    `json:"-" validate:"required"`
	*Config               `json:"-" validate:"required"`
	*ParameterInformation `json:"-" validate:"required"`
	// contains filtered or unexported fields
}

AWSSSM provider definition.

func (*AWSSSM) Load

func (a *AWSSSM) Load(ctx context.Context, opts ...option.LoadKeyFunc) (map[string]string, error)

Load retrieves parameters from AWS SSM Parameter Store and exports them to the environment.

func (*AWSSSM) Write

func (a *AWSSSM) Write(ctx context.Context, values map[string]interface{}, opts ...option.WriteFunc) error

Write stores parameters in AWS SSM Parameter Store.

type Config

type Config struct {
	Region    string `json:"region"     validate:"omitempty,gte=1"`
	Profile   string `json:"profile"    validate:"omitempty,gte=1"`
	AccessKey string `json:"access_key" validate:"omitempty,gte=1"`
	SecretKey string `json:"secret_key" validate:"omitempty,gte=1"`
}

Config contains AWS configuration settings.

type ParameterInformation

type ParameterInformation struct {
	// ParameterNames is a list of specific parameter names to retrieve.
	ParameterNames []string `json:"parameter_names" validate:"omitempty"`

	// Path is a parameter path prefix. If set, all parameters under this path
	// will be retrieved recursively.
	Path string `json:"path" validate:"omitempty"`

	// Recursive determines whether to recursively retrieve all parameters under Path.
	// Only applicable when Path is set.
	Recursive bool `json:"recursive"`

	// WithDecryption determines whether to decrypt SecureString parameters.
	// When using the CLI, this defaults to true (decryption enabled).
	// When using the library directly, set this explicitly.
	WithDecryption bool `json:"with_decryption"`
}

ParameterInformation contains information about which parameters to retrieve.

Jump to

Keyboard shortcuts

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