Skip to main content

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:
  1. Cloud integration: Your AWS account is connected to Formal via a cloud integration
  2. AWS permissions: Your IAM user or role has permission to call sts:GetCallerIdentity
  3. Machine identity: A machine identity exists in Formal with the same name as your AWS principal (IAM user or role name)
You must create a machine identity in Formal with the exact same name as your AWS principal before authentication will work. See Machine Identity Setup below.

How It Works

AWS SigV4 authentication with Formal follows this flow:
  1. Your client creates a presigned AWS STS GetCallerIdentity URL using your AWS credentials
  2. The client includes this presigned URL in the Authorization header with format: Authorization: AWS4-Presigned-URL <presigned_url>
  3. Formal verifies the signature by calling AWS STS with the presigned URL
  4. Formal extracts your AWS account ID and principal name from the STS response
  5. Formal matches your AWS account to your organization via the cloud integration
  6. 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:
  1. Navigate to Users in the Formal console
  2. Click Create User and choose Machine
  3. 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
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: alice
  • arn:aws:iam::123456789012:role/DataPipeline → Principal name: DataPipeline
  • arn: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:
Assign machine identities to groups for easier access management. This allows you to write policies based on group membership instead of individual identities.

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:GetCallerIdentity permission

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 named alice
  • For IAM role arn:aws:iam::123:role/DataPipeline, create identity named DataPipeline
  • For assumed role arn:aws:sts::123:assumed-role/MyRole/session, create identity named MyRole

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 Authorization header 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

Additional Resources