Metadata-Version: 2.1
Name: aws-sm
Version: 1.2.1
Summary: A Python wrapper around the AWS Secrets Manager using Boto3
Author-email: Jumpei Sakatsu <saka2jp@gmail.com>
License: MIT License
        
        Copyright (c) 2023 Jumpei Sakatsu
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
        
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: boto3 (~=1.16)
Provides-Extra: dev
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: flake8 ; extra == 'dev'
Requires-Dist: flake8-isort ; extra == 'dev'
Requires-Dist: flake8-polyfill ; extra == 'dev'
Requires-Dist: radon ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'
Requires-Dist: pytest-mock ; extra == 'dev'

[![test](https://github.com/saka2jp/aws-sm/actions/workflows/test.yml/badge.svg)](https://github.com/saka2jp/aws-sm/actions/workflows/test.yml) [![GitHub](https://img.shields.io/github/license/mashape/apistatus.svg)](https://opensource.org/licenses/MIT) [![Downloads](https://pepy.tech/badge/aws-sm)](https://pepy.tech/project/aws-sm)

# aws-sm

A Python wrapper around [AWS Secrets Manager](https://aws.amazon.com/jp/secrets-manager/) using Boto3.

# Installation

Installing from PyPI is as easy as doing:

```sh
$ pip install aws-sm
```

# Usage

```python
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`.

<img width="990" alt="0030-09-25 22 32 21" src="https://user-images.githubusercontent.com/24784855/46020218-d4e5b580-c118-11e8-9aa7-69edbecb8de2.png">

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](https://docs.aws.amazon.com/secretsmanager/latest/userguide/auth-and-access_identity-based-policies.html).

# Set Up Loacally

Make sure you have [Docker Compose](https://docs.docker.com/compose/install/).

```sh
$ docker-compose up
```

## Run test

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