Skip to main content
<title>AWS SSO Tool</title>

AWS SSO Tool

A simple CLI tool to help developers connect to AWS via SSO and perform basic AWS operations, such as listing S3 buckets, uploading and downloading files, and managing EC2 instances. This tool ensures that AWS SSO tokens are automatically renewed when needed, streamlining the AWS login process for developers.

Features

  • Automatically handle AWS SSO login and token management.
  • List S3 buckets in your AWS account.
  • Upload files to and download files from S3.
  • List EC2 instances and manage their state (start/stop).

Installation

To install the aws-sso-tool, you can use pip:

pip install aws-sso-tool

This will install the tool and its dependencies.

Usage

Once the tool is installed, you can access it from the command line using the aws-sso-tool command. Below are the common commands and options available:

Basic Commands

  1. Set the Default AWS Profile

    You can set or change the default AWS profile to be used for SSO authentication:

    aws-sso-tool --set-default

    This command will prompt you to enter your AWS profile name.

  2. <li><strong>Set or Change the AWS Region</strong>
    <p>You can set the default AWS region for operations:</p>
    <pre><code>aws-sso-tool --set-region</code></pre>
    <p>The command will fetch a list of available regions from AWS and prompt you to choose one.</p>
    </li>
    
    <li><strong>List S3 Buckets</strong>
    <p>List all S3 buckets in the connected AWS account:</p>
    <pre><code>aws-sso-tool --list-buckets</code></pre>
    <p>This will display all the S3 buckets under the connected AWS account.</p>
    </li>
    
    <li><strong>Upload a File to S3</strong>
    <p>Upload a file to a specific S3 bucket:</p>
    <pre><code>aws-sso-tool --upload-file &lt;file_path&gt; &lt;bucket_name&gt;</code></pre>
    <p>Optionally, you can provide an <code>object_name</code> to set the name of the file in S3:</p>
    <pre><code>aws-sso-tool --upload-file &lt;file_path&gt; &lt;bucket_name&gt; --object-name &lt;object_name&gt;</code></pre>
    </li>
    
    <li><strong>Download a File from S3</strong>
    <p>Download a file from a specific S3 bucket:</p>
    <pre><code>aws-sso-tool --download-file &lt;bucket_name&gt; &lt;object_name&gt; &lt;file_path&gt;</code></pre>
    <p>This command will download the file from S3 to the specified path.</p>
    </li>
    
    <li><strong>List EC2 Instances</strong>
    <p>List all EC2 instances in the selected AWS region:</p>
    <pre><code>aws-sso-tool --list-instances</code></pre>
    </li>
    
    <li><strong>Start an EC2 Instance</strong>
    <p>Start an EC2 instance by specifying its instance ID:</p>
    <pre><code>aws-sso-tool --start-instance &lt;instance_id&gt;</code></pre>
    </li>
    
    <li><strong>Stop an EC2 Instance</strong>
    <p>Stop an EC2 instance by specifying its instance ID:</p>
    <pre><code>aws-sso-tool --stop-instance &lt;instance_id&gt;</code></pre>
    </li>
    

Configuration

AWS Profile

The tool allows you to set the AWS profile you want to use with SSO. When you first run the tool, you'll be prompted to set the AWS profile. The profile will be saved to a local file and used as the default for subsequent operations.

AWS Region

Similarly, the tool will ask for your preferred AWS region the first time you run it. You can set or change the region using the --set-region command at any time.

Automatic SSO Token Renewal

The tool automatically checks the SSO token expiration and renews it if needed. It will only prompt for a login via the browser when necessary.

Error Handling

The tool handles various errors, such as:

  • Invalid AWS credentials: If the AWS SSO token is expired or invalid, the tool will automatically attempt to renew it.
  • Connection issues: If there is an issue connecting to AWS, the error will be logged, and the user will be informed.
  • File not found: For file operations (upload/download), if the specified file path is invalid, the tool will log the error and inform the user.

Development

To install the tool in development mode:

pip install -e .

Running Tests

You can run the tests using pytest:

pytest tests/

This will execute all the unit tests for the tool.

Contributing

Contributions are welcome! If you'd like to contribute, feel free to fork the repository and submit a pull request. Please make sure to write tests for any new functionality.

License

This project is licensed under the MIT License. See the LICENSE file for more information.

Metadata

Release files for aws-sso-tool 0.1.14

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for aws-sso-tool 0.1.14
File Size Uploaded Provenance
aws_sso_tool-0.1.14.tar.gz 11.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for aws-sso-tool 0.1.14
File Interpreter ABI Platform
aws_sso_tool-0.1.14-py3-none-any.whl Python 3 none any Details

Total release size: 21.9 kB

Release files / aws_sso_tool-0.1.14.tar.gz

Download URL aws_sso_tool-0.1.14.tar.gz
Size 11.1 kB
Tags Source
SHA-256 checksum
How to use checksums
7e86c1a1199a75dea4cd10429561f4e383c590c2b2a94faa49e5907272f6ab68
BLAKE2b-256 checksum
How to use checksums
242181d17fbf9c4da7f940953de2ba2ee892768141b9fb376d6bb43275b6fd0a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Release files / aws_sso_tool-0.1.14-py3-none-any.whl

Download URL aws_sso_tool-0.1.14-py3-none-any.whl
Size 10.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d4f556a9e21dc97bbc6ba07ad6731c9779521ff9a51af73a302a715bfc312c23
BLAKE2b-256 checksum
How to use checksums
6ca7d6b8d2611ece868d32fd398ea32320584d5378dc04378dd31275594254b7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/5.1.1 CPython/3.12.7

Security for aws-sso-tool 0.1.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page