> ## Documentation Index
> Fetch the complete documentation index at: https://mage-staging.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# AWS Secrets Manager

### Python

To use secrets in Python code, read these [instructions](/design/data-loading#aws-secret-loader).

### YAML

To use secrets in YAML files (e.g. in data integration pipelines):

1. Add the following keys and values to your environment variables or as Mage secrets so that
   Mage can access the AWS Secrets Manager:
   1. `AWS_ACCESS_KEY_ID` (not needed if using IAM role to authenticate)
   2. `AWS_SECRET_ACCESS_KEY` (not needed if using IAM role to authenticate)
   3. `AWS_DEFAULT_REGION` (or `AWS_REGION_NAME`)
2. Store a secret in AWS Secrets Manager.
3. Use the following syntax in your YAML file to interpolate secret values from AWS Secrets Manager:

   ```yaml theme={null}
   "{{ aws_secret_var('some_name_for_secret') }}"
   ```

   For example:

   ```yaml theme={null}
   api_key: "{{ aws_secret_var('API_KEY') }}"
   access_token: "{{ aws_secret_var('ACCESS_TOKEN') }}"
   ```
