When building apps with the SDK, you can offer users the option to securely store and retrieve database credentials from supported secret management services instead of entering them directly.
Why Use Secret Stores?
Using secret stores offers several important advantages:Enhanced Security
Credentials are stored and managed in a specialized secure service with encryption at rest and in transit.
Centralized Management
Credentials can be rotated and updated in one place without modifying application code.
Access Control
Secret stores provide fine-grained access controls and comprehensive audit logging.
Compliance
Help meet regulatory requirements for credential management and data security.
Supported Secret Stores
The Application SDK Framework currently supports:AWS Secrets Manager
AWS Secrets Manager
A secure service that helps store, retrieve, and rotate database credentials, API keys, and other secrets throughout their lifecycle.
Implementation Guide
For App Developers
If you’re developing an app using the Application SDK Framework, follow these steps to integrate secret store support:Add Credential Source Selection
Include a dropdown or similar control that allows users to select where their credentials are stored:
Collect Secret Store Metadata
Add form fields to collect necessary metadata based on the selected secret store:
Handle Credential Resolution
The framework automatically resolves credentials based on the source selected:
JavaScript Example
Here’s a complete example of handling credential source changes in your UI:AWS Secrets Manager Guide
For End Users
End users of your application can set up their credentials in AWS Secrets Manager by following these steps:Log in to AWS Console
Navigate to the AWS Management Console and open the AWS Secrets Manager service.
Create a New Secret
- Click “Store a new secret”
- Select “Other type of secret”
- Enter credentials as key-value pairs
Configure Secret Settings
- Give the secret a descriptive name (e.g., “my-postgres-connection”)
- Optionally configure automatic rotation settings
- Add tags for organization
Authentication Types
- Basic Auth
- IAM User
- IAM Role
For basic username/password authentication:Required keys:
username: Database usernamepassword: Database password
Using Credentials in Your App
When users set up a connection in your app:Reference Key Names
Instead of entering actual credentials, enter the key names from the secret:
- If the secret contains a key named
postgres_password, enterpostgres_passwordin the Password field - The framework will automatically retrieve the actual value from AWS Secrets Manager
The framework automatically retrieves and substitutes the actual values from AWS Secrets Manager at runtime.
Troubleshooting
Connection Failures
Connection Failures
If your connection fails when using AWS Secrets Manager:
- Verify Secret ARN: Ensure the ARN is correct and the secret exists
- Check Region: Confirm the AWS region is correctly specified
- Validate Key Names: Ensure key names in the form exactly match the keys in the AWS secret
- Check IAM Permissions: Verify the platform/environment has appropriate IAM permissions:
secretsmanager:GetSecretValuesecretsmanager:DescribeSecret
- Review CloudTrail: Check AWS CloudTrail logs for access denied errors
Invalid Credentials
Invalid Credentials
If credentials are retrieved but connection still fails:
- Check Secret Contents: Ensure the secret contains all required credential fields
- Verify Values: Confirm credential values in the secret store are correct and up-to-date
- Test Direct Connection: Try connecting with the credentials directly to isolate the issue
- Check Credential Rotation: If using automatic rotation, ensure the credentials haven’t been rotated mid-connection
Permission Denied
Permission Denied
If you see permission denied errors:
- IAM Role: Verify the IAM role attached to the application has the necessary permissions
- Resource Policy: Check if the secret has a resource policy that restricts access
- Service Control Policies: Ensure no SCPs are blocking Secrets Manager access
- Cross-Account Access: If accessing secrets from another account, verify trust relationships
Secret Not Found
Secret Not Found
If the secret cannot be found:
- ARN Format: Verify the ARN format is correct
- Region Mismatch: Ensure you’re looking in the correct AWS region
- Secret Deletion: Check if the secret was deleted (secrets have a recovery window)
- Account Access: Confirm you’re accessing the correct AWS account
Technical Details
Credential Resolution Process
The credential resolution follows these steps:Collect User Input
The application UI collects credential information including the source type and necessary metadata.
Select Provider
Based on the credential source, the appropriate credential provider is selected from the factory.
Extract Metadata
For secret store providers, necessary metadata (ARN, region, etc.) is extracted from the credential object.
Retrieve Credentials
The provider connects to the secret store service and retrieves the actual credentials:
Substitute Values
Retrieved values are substituted for key references in the original credential object.
Extending Support
To add support for additional secret stores:Security Best Practices
Least Privilege
Grant only the minimum necessary permissions to access secrets. Use specific resource ARNs instead of wildcards.
Enable Encryption
Use AWS KMS encryption for secrets at rest with customer-managed keys when possible.
Audit Access
Enable AWS CloudTrail logging to track all secret access and modifications.
Rotate Regularly
Implement automatic credential rotation to minimize the impact of credential compromise.
Use VPC Endpoints
Access Secrets Manager through VPC endpoints to avoid internet exposure.
Tag Secrets
Use tags to organize secrets and implement tag-based access control policies.
Next Steps
SQL Applications
Build SQL applications with secure credential management.
Best Practices
Follow best practices for application security and reliability.
AWS Secrets Manager
Learn more about AWS Secrets Manager features and capabilities.
Configuration
Configure your application with environment variables and settings.