Skip to content

Commit 199f2a1

Browse files
author
Tom McCarthy
committed
docs: update documentation for parameters util with changes to boto3 session
1 parent b9834aa commit 199f2a1

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed

docs/utilities/parameters.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -501,3 +501,40 @@ Here is the mapping between this utility's functions and methods and the underly
501501
| DynamoDB | `DynamoDBProvider.get` | `dynamodb` | ([Table resource](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#table)) | [get_item](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Table.get_item)
502502
| DynamoDB | `DynamoDBProvider.get_multiple` | `dynamodb` | ([Table resource](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#table)) | [query](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/dynamodb.html#DynamoDB.Table.query)
503503
| App Config | `get_app_config` | `appconfig` | [get_configuration](https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/appconfig.html#AppConfig.Client.get_configuration) |
504+
505+
506+
### Customizing boto configuration
507+
508+
You can provide a custom boto configuration via **`config`**, or use a custom boto session via **`boto3_session`** parameters, when constructing any of the built-in provider classes.
509+
510+
> **Example**
511+
512+
513+
=== "Custom session"
514+
515+
```python hl_lines="2 4 5"
516+
from aws_lambda_powertools.utilities import parameters
517+
import boto3
518+
519+
boto3_session = boto3.session.Session()
520+
ssm_provider = parameters.SSMProvider(boto3_session=boto3_session)
521+
522+
def handler(event, context):
523+
# Retrieve a single parameter
524+
value = ssm_provider.get("/my/parameter")
525+
...
526+
```
527+
=== "Custom config"
528+
529+
```python hl_lines="2 4 5"
530+
from aws_lambda_powertools.utilities import parameters
531+
from botocore.config import Config
532+
533+
boto_config = Config()
534+
ssm_provider = parameters.SSMProvider(config=boto_config)
535+
536+
def handler(event, context):
537+
# Retrieve a single parameter
538+
value = ssm_provider.get("/my/parameter")
539+
...
540+
```

0 commit comments

Comments
 (0)