A CLI tool to simplify AWS interactions, built with Go and the Cobra library.
aws-ug-cli is a CLI tool that simplifies interactions with AWS services like S3 and ECS. It follows a layered architecture:
- cmd layer: Handles command configuration, argument parsing, and calls to the service layer
- service layer: Contains the core logic for each command and interacts with the AWS client layer
- awsclient layer: Abstracts AWS SDK clients behind Go interfaces for better testability
The CLI supports AWS credentials through environment variables:
export AWS_ACCESS_KEY_ID="your_access_key"
export AWS_SECRET_ACCESS_KEY="your_secret_key"
export AWS_SESSION_TOKEN="your_session_token" # Optional
export AWS_REGION="your_region" # e.g., us-east-1The AWS SDK will automatically pick up these environment variables. You can also use other AWS credential providers like:
- AWS credentials file (
~/.aws/credentials) - IAM roles for Amazon EC2 or ECS tasks
- AWS SSO
To build the CLI, you need Go 1.19 or later.
# Clone the repository
git clone https://github.com/username/aws-ug-cli.git
cd aws-ug-cli
# Install dependencies
go mod tidy
# Build the CLI
go build -o aws-ug-cli
# (Optional) Install the CLI
go installTo run the tests for the CLI:
go test -v ./...This will run all tests in the project, ensuring that commands like version work as expected.
Displays the current version of the CLI.
aws-ug-cli versionLists configured apps.
aws-ug-cli apps listFlush cache from a given domain
aws-ug-cli cache flush --domain <your-domain>aws-ug-cli db dump --table productsThe CLI follows a layered architecture:
- cmd layer: Uses Cobra to define commands, flags, and parse arguments
- service layer: Contains the business logic for each command
- awsclient layer: Provides interfaces and implementations for AWS services
This separation allows for easier testing and maintenance.