Skip to main content

A Python wrapper around the AWS Secrets Manager using Boto3

Project description

test GitHub Downloads

aws-sm

A Python wrapper around AWS Secrets Manager using Boto3.

Installation

Installing from PyPI is as easy as doing:

$ pip install aws-sm

Usage

from aws_sm import SecretsManager

AWS_ACCESS_KEY_ID = ***************
AWS_SECRET_ACCESS_KEY = ***************

secretsmanager = SecretsManager('us-east-1', AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY)
secrets = secretsmanager.get_secret_values('tutorials/MyFristTutorialSecret')

USER_NAME = secretsmanager.get_secret_value('USER_NAME', secrets)
PASSWORD = secretsmanager.get_secret_value('PASSWORD', secrets)

This is sample code using aws-sm to get USER_NAME and PASSWORD from tutorials/MyFristTutorialSecret.

USER_NAME and PASSWORD are Secret value.
tutorials/MyFristTutorialSecret is Secret name.

0030-09-25 22 32 21

This is AWS Console of Secrets Manager.

AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY are unnecessary when attaching the appropriate IAM Role. The default policy is SecretsManagerReadWrite.

Set Up Loacally

Make sure you have Docker Compose.

$ docker-compose up

Run test

$ docker-compose exec app bash
root@d5d52d6765d9:/app# py.test -v

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

aws-sm-1.3.0.tar.gz (23.1 kB view hashes)

Uploaded Source

Built Distribution

aws_sm-1.3.0-py3-none-any.whl (4.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page