pythonamazon-web-servicesboto3aws-secrets-manager

Retrieve AWS secrets using boto3


I want to retrieve AWS secrets using python boto3 and I came across this sample code:

But it is confusing. I don't see boto3 library import in the python file. Not an expert of Python, so any help in understanding this much appreciated.

I was expecting to have the AWS secrets name and boto3 library as part of the python function.


Solution

  • Per the documentation, each of the example folders has one or more main runner scripts.

    For the Secrets Manager examples, you would run either:

    1. python scenario_get_secret.py, or
    2. python scenario_get_batch_secrets.py

    Each of these 'runner' scripts imports the relevant Python code e.g. get_secret_value.py.

    The code is structured this way so that you can easily test the code while separating the test code from the reusable utility code (that you would potentially use).