Overview
Formal’s API supports authentication using AWS Signature Version 4 (SigV4). This enables you to authenticate using your AWS IAM credentials directly, eliminating the need to manage separate API keys.Prerequisites
Before using AWS SigV4 authentication with Formal, ensure:- Cloud integration: Your AWS account is connected to Formal via a cloud integration
- AWS permissions: Your IAM user or role has permission to call
sts:GetCallerIdentity - Machine identity: A machine identity exists in Formal with the same name as your AWS principal (IAM user or role name)
How It Works
AWS SigV4 authentication with Formal follows this flow:- Your client creates a presigned AWS STS
GetCallerIdentityURL using your AWS credentials - The client includes this presigned URL in the
Authorizationheader with format:Authorization: AWS4-Presigned-URL <presigned_url> - Formal verifies the signature by calling AWS STS with the presigned URL
- Formal extracts your AWS account ID and principal name from the STS response
- Formal matches your AWS account to your organization via the cloud integration
- Formal authorizes the request using your machine identity and authorization policies
Machine Identity Setup
Before using AWS SigV4 authentication, create a machine identity in Formal that matches your AWS principal name:- Navigate to Users in the Formal console
- Click Create User and choose Machine
- Use the exact name of your AWS principal:
- For IAM user
arn:aws:iam::123456789012:user/DataPipeline, use name:DataPipeline - For IAM role
arn:aws:iam::123456789012:role/ETLService, use name:ETLService - For assumed role
arn:aws:sts::123456789012:assumed-role/MyRole/session, use name:MyRole
- For IAM user
The machine identity name must exactly match the AWS principal name for
authentication to succeed.
Usage Examples
TypeScript/JavaScript
Python
Go
cURL
Authorization
Requests authenticated with AWS SigV4 use machine identities for authorization. The principal name extracted from your AWS ARN becomes your identity in Formal’s authorization system.Principal Name Extraction
Formal extracts the principal name from your AWS ARN as follows:arn:aws:iam::123456789012:user/alice→ Principal name:alicearn:aws:iam::123456789012:role/DataPipeline→ Principal name:DataPipelinearn:aws:sts::123456789012:assumed-role/ETLService/session→ Principal name:ETLService
Policy-Based Access Control
Use Formal’s authorization policies to control access based on machine identities and groups:Security Considerations
Signature Expiration
Presigned URLs expire after 10 minutes by default. Generate a fresh URL for each API request or batch of requests within that timeframe.Organization Isolation
Formal enforces strict organization isolation:- Only active cloud integrations are considered for authentication
- Your AWS account ID must match an active cloud integration
- All API requests are scoped to your organization
- A matching machine identity must exist
Troubleshooting
Invalid AWS signature
Error: “Invalid AWS signature” or “Signature verification failed” Solutions:- Verify your AWS credentials are valid and not expired
- Ensure the presigned URL was generated correctly
- Check that the presigned URL hasn’t expired (10-minute limit)
- Confirm your IAM user/role has
sts:GetCallerIdentitypermission
No active cloud integration
Error: “No active cloud integration found for this AWS account” Solutions:- Verify your AWS account is connected to Formal via a cloud integration
- Ensure the cloud integration is marked as active
- Confirm the AWS account ID matches your cloud integration
No machine identity found
Error: “No machine identity found with name ‘X’” Solutions:- Create a machine identity in Formal with the exact same name as your AWS principal
- For IAM user
arn:aws:iam::123:user/alice, create identity namedalice - For IAM role
arn:aws:iam::123:role/DataPipeline, create identity namedDataPipeline - For assumed role
arn:aws:sts::123:assumed-role/MyRole/session, create identity namedMyRole
Forbidden access
Error: “Forbidden” or “Permission denied” Solutions:- Check your authorization policies allow the machine identity to access the requested endpoint
- Verify the machine identity is assigned to the correct groups
- Confirm the principal name is correctly extracted from your AWS ARN
- Review your group-based authorization policies
Missing or invalid Authorization header
Error: “No Authorization header found” or “Authorization header must start with ‘AWS4-Presigned-URL ’” Solutions:- Ensure you’re including the
Authorizationheader in your request - Verify the header format is exactly
Authorization: AWS4-Presigned-URL <presigned_url> - Check that the presigned URL is properly formatted and included after the space