Metadata-Version: 2.1
Name: aws-authenticator
Version: 2022.10.1.3
Summary: Login to AWS using CLI named profiles, IAM access key credentials, or SSO.
Home-page: https://github.com/fer1035/pypi-aws_authenticator
License: GPL-2.0-only
Keywords: AWS,login,profile,access key,SSO
Author: Ahmad Ferdaus Abd Razak
Author-email: ahmad.ferdaus.abd.razak@ni.com
Requires-Python: >=3.6,<4.0
Classifier: License :: OSI Approved :: GNU General Public License v2 (GPLv2)
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Requires-Dist: aws-ssooidc (>=2021.1.1.1,<2022.0.0.0)
Requires-Dist: boto3 (>=1.17.78,<2.0.0)
Project-URL: Repository, https://github.com/fer1035/pypi-aws_authenticator
Description-Content-Type: text/x-rst

=====================
**aws-authenticator**
=====================

Overview
--------

Login to AWS using CLI named profiles, IAM access key credentials, or SSO.

Prerequisites
-------------

- *Python >= 3.6*
- *aws-ssooidc (https://pypi.org/project/aws-ssooidc/) >= 2021.1.1.1*
- *boto3 (https://pypi.org/project/boto3/) >= 1.17.78*

Conditional Arguments
---------------------

If authenticating with named profiles:

- AWSCLI profile name

If authenticating with IAM acccess key credentials:

- AWS access key id
- AWS secret access key

If authenticating with SSO:

- AWS account ID
- AWS SSO Permission Set (role) name
- AWS SSO login URL

Usage
-----

Installation:

.. code-block:: BASH

   pip3 install aws-authenticator
   # or
   python3 -m pip install aws-authenticator

In Python3 authenticating with named profiles:

.. code-block:: PYTHON

   import aws_authenticator

   auth = aws_authenticator.AWSAuthenticator(
      profile_name="<profile-name>",
   )
   session = auth.profile()
   client = session.client("<service-name>")

In Python3 authenticating with IAM access key credentials:

.. code-block:: PYTHON

   import aws_authenticator

   auth = aws_authenticator.AWSAuthenticator(
      access_key_id="<access-key-id>",
      secret_access_key="<secret-access-key>",
   )
   session = auth.iam()
   client = session.client("<service-name>")

In Python3 authenticating with SSO:

.. code-block:: PYTHON

   import aws_authenticator

   auth = aws_authenticator.AWSAuthenticator(
      sso_url="<sso-url>",
      sso_role_name="<sso-role-name>",
      sso_account_id="<sso-account-id>",
   )
   session = auth.sso()
   client = session.client("<service-name>")

Testing Examples
----------------

Testing SSO-based login in Python3:

.. code-block:: PYTHON

   import aws_authenticator

   auth = aws_authenticator.AWSAuthenticator(
      sso_url="<sso-url>",
      sso_role_name="<sso-role-name>",
      sso_account_id="<sso-account-id>",
   )
   session = auth.sso()
   client = session.client("sts")

   response = client.get_caller_identity()
   print(response)

Testing profile-based login as a script in BASH:

.. code-block:: BASH

   python [/path/to/]aws_authenticator \
   -m profile \
   -p <profile-name>

