Retrieves cloud identity
Currently, AWS, GCP, Azure and Alibaba Cloud are supported. In order to get cloud identity you should import this package and call the relevant method per your chosen CSP:
- AWS: "generate" (If no aws access id/key and token are provided they will be retrieved automatically from the default session.)
- GCP: "generateGcp"
- Azure: "generateAzure"
- Alibaba Cloud: "generateAlibaba" (If no access key/secret are provided they will be retrieved from environment variables or an ECS RAM role.)
pip install git+https://github.com/akeylesslabs/akeyless-python-cloud-id
# if using on AWS
pip install git+https://github.com/akeylesslabs/akeyless-python-cloud-id[aws]
# if using on GCP
pip install git+https://github.com/akeylesslabs/akeyless-python-cloud-id[gcp]
# if using on Azure
pip install git+https://github.com/akeylesslabs/akeyless-python-cloud-id[azure]
from akeyless_cloud_id import CloudId
cloud_id = CloudId()
# for AWS:
id = cloud_id.generate()
# for Azure:
id = cloud_id.generateAzure()
# for GCP:
id = cloud_id.generateGcp()
# for Alibaba Cloud:
id = cloud_id.generateAlibaba()
Such code can be used, for example, in order to retrieve secrets from Akeyless as part of AWS Code Pipeline:
import akeyless_api_gateway
from akeyless_cloud_id import CloudId
configuration = akeyless_api_gateway.Configuration()
configuration.host="http://<api-gateway-host>:<port>"
api_instance = akeyless_api_gateway.DefaultApi(akeyless_api_gateway.ApiClient(configuration))
cloud_id = CloudId()
id = cloud_id.generate()
# for Azure use: id = cloud_id.generateAzure()
# for GCP use: id = cloud_id.generateGcp()
access_id = event['CodePipeline.job']['data']['actionConfiguration']['configuration']['UserParameters']
auth_response = api_instance.auth(access_id, access_type="aws_iam", cloud_id=id)
token = auth_response.token
postgresPassword = api_instance.get_secret_value("PostgresPassword", token)
The release process is automated via GitHub Actions. There are two ways to release:
-
Update the version in
akeyless_cloud_id/__init__.pyaccording to Semantic Versioning- If anything changed in the dependency of packages, or in the description meant to be shown in PyPi, make sure to update the
README.rstfile accordingly!
- If anything changed in the dependency of packages, or in the description meant to be shown in PyPi, make sure to update the
-
Open a PR with your changes, get an approval and merge to master.
-
Create and push a version tag from the master branch:
git checkout master git pull git tag v0.3.1 # Use the same version as in __init__.py git push origin v0.3.1 -
Automated CI/CD will validate, build, and publish to PyPI.
-
Go to Actions tab: https://github.com/akeylesslabs/akeyless-python-cloud-id/actions/workflows/release.yml
-
Click "Run workflow"
-
Fill in the details:
- Branch:
master(or your target branch) - Version:
0.3.1(orv0.3.1- both formats work) - Auto-update version:
- ☑️ Checked: Automatically updates
__init__.pyand commits the change - ☐ Unchecked: Validates that version in
__init__.pyalready matches
- ☑️ Checked: Automatically updates
- Branch:
-
Click "Run workflow" - The CI will build and publish to PyPI
- Validates version (or auto-updates if checkbox is checked)
- Builds the distribution packages (sdist and wheel)
- Validates the artifacts with twine
- Publishes to PyPI (requires
publish-pypisecret configured) - Creates a GitHub release with the artifacts
If you need to release manually:
- Build pypi expected artifacts:
python3 setup.py sdist bdist_wheel
- Validate artifacts:
twine check dist/* - Upload artifacts to PyPi:
python3 -m twine upload dist/*