Skip to main content

Integrate SSO into Your Code

Use AWS Single Sign-On (SSO) profiles locally and Identity and Access Management (IAM) roles in the cloud for secure, environment-aware access.

Development Principles

  • Local vs. cloud: Use SSO profiles for local development; use IAM roles in cloud environments
  • Least privilege: Grant only the permissions your application needs
  • No hardcoded secrets: Never store access keys or sensitive data in code or .env files
  • Consistent naming: Reuse the same profile name across projects (e.g., <project>-workload-development)

Credential Resolution Overview

Your app decides credentials depending on the runtime environment:

Environment Detection Pattern

Use a simple, reliable signal like AWS_PROFILE, .env.local, or NODE_ENV=development.

Python Example (boto3)

Installation

Basic Implementation

Environment Configuration

Node.js Example (AWS SDK v3)

Installation

Implementation Examples

Environment Configuration

Go Example

For Go applications, AWS provides excellent SSO support through the official SDK.

Installation

Implementation

Development Workflow Best Practices

Environment Setup

Use environment-specific files and variables.

Common Patterns and Tips

Best practices for detecting local vs. cloud environments:
Handle common SSO-related errors gracefully:
Validate your configuration before running: