AWS SSM Parameter Store SecretManager class
This class provides some functions for retrieving secrets / parameters stored in AWS Parameter Store
Getting started
pip install ssm_secret_manager
Create a SecretManager instance
from ssm_secret_manager import SecretManager
CONFIG = {
'region_name': 'us-east-1',
'SECRETS': {
'secret_name_1': 'secret_key_1_in_parameter_store',
'secret_name_2': 'secret_key_2_in_parameter_store'
}
}
secret_manager = SecretManager(
region_name=CONFIG['region_name'],
secrets_mapping=CONFIG['SECRETS']
)
SecretManager will fetch the value from parameter store based on the key defined in the secrets_mapping dictionary, and set the value of the parameter to the secret name.
# subsequently, you access the secret via the following line
secret_value_1 = secret_manager.get_secret('secret_name_1')
secret_value_2 = secret_manager.get_secret('secret_name_2')
Common Question
-
Encountered ParameterNotFound
- Make sure the secret is being defined in the correct region in AWS, and your AWS profile has the permission to view the secret (i.e. correct IAM role permission)
-
What is the differences between
secret_nameandsecret_key_in_parameter_storeshown in the code example?-
secret_key_in_parameter_storeis the name of the parameter in AWS Parameter Store -
secret_nameallows you to have a common variable / key name to access to the value of secret given different environment -
For example, you have a
secret_name-DB_PASSWORD. In dev environment yoursecret_key_in_parameter_storemight be set toDEV_DB_PASSWORDwhile your prod environment it's set toPROD_DB_PASSWORD. Using SecretManager, you can retrieve the value for different environment using the common key nameDB_PASSWORD, i.e.
secret_manager.get_secret('DB_PASSWORD') -
Metadata
Release files for ssm-secret-manager 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| ssm_secret_manager-0.1.1.tar.gz | 2.5 kB | Without provenance | Details for ssm_secret_manager-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ssm_secret_manager-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for ssm_secret_manager-0.1.1-py3-none-any.whl |
Total release size: 6.2 kB
Release files / ssm_secret_manager-0.1.1.tar.gz
| Download URL | ssm_secret_manager-0.1.1.tar.gz |
|---|---|
| Size | 2.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
ffd42610a48d911e14a4a1940d8ff217bd0d3f9a787d418d152b624f0cf3709d
|
|
BLAKE2b-256 checksum How to use checksums |
99f3bcc34336e48886c2fd3d52a74213ff0543fd4e9e8bbb8debb25898e859d0
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4
|
Release files / ssm_secret_manager-0.1.1-py3-none-any.whl
| Download URL | ssm_secret_manager-0.1.1-py3-none-any.whl |
|---|---|
| Size | 3.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
07caf5c82cd3337681ac6c7402c83a6688e6b4cc8676ec4312fd459cc0cfdfe3
|
|
BLAKE2b-256 checksum How to use checksums |
19e6dd6c4ede961f2f23fe97f326007a4f366b6768733af41a9ef7e3f61603cc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/45.0.0 requests-toolbelt/0.9.1 tqdm/4.41.1 CPython/3.7.4
|
Security for ssm-secret-manager 0.1.1
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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.