https://github.com/peak-ai/eks-token
Python Package to get EKS auth token (Alternative to "aws eks get-token ...." CLI)
https://github.com/peak-ai/eks-token
boto3 eks k8s k8scluster python token
Last synced: 3 months ago
JSON representation
Python Package to get EKS auth token (Alternative to "aws eks get-token ...." CLI)
- Host: GitHub
- URL: https://github.com/peak-ai/eks-token
- Owner: peak-ai
- License: lgpl-2.1
- Created: 2020-09-28T11:52:14.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2025-01-03T07:24:56.000Z (6 months ago)
- Last Synced: 2025-03-29T04:08:02.863Z (4 months ago)
- Topics: boto3, eks, k8s, k8scluster, python, token
- Language: Python
- Homepage:
- Size: 80.1 KB
- Stars: 28
- Watchers: 2
- Forks: 17
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
# eks-token
EKS Token package, an alternate to "aws eks get-token ..." CLI          

## Usage
### Installation
```shell
pip install eks-token
```### Basic usage
```python
from eks_token import get_token
from pprint import pprintresponse = get_token(cluster_name='')
pprint(response)
```
Expected Output
```python
{'apiVersion': 'client.authentication.k8s.io/v1alpha1',
'kind': 'ExecCredential',
'spec': {},
'status': {'expirationTimestamp': '2020-10-01T15:05:17Z',
'token': 'k8s-aws-v1.'}}
```### Extract token from response
```python
from eks_token import get_tokentoken = get_token(cluster_name='value')['status']['token']
print(token)
```### Get Token signed for particular IAM role
Pass `role_arn` argument to the function
```python
from eks_token import get_tokentoken = get_token(cluster_name='', role_arn='')['status']['token']
print(token)
```### Custom region
```python
from eks_token import get_tokencluster_name = "your-cluster-name"
role_arn = "your-role-arn"
region_name = "your-region-name"token = get_token(cluster_name, role_arn=role_arn, region_name=region_name)
print(token)
```## Contribution
Check our guidelines [here](CONTRIBUTING.md)