Skip to main content

AWS Provider

The AWS provider is a production-ready implementation of the cloud provider abstraction, using AWS DynamoDB for storage, Secrets Manager for configuration and secrets, and CloudWatch for metrics.

Prerequisites

AWS Account Requirements

  • Active AWS account with appropriate permissions
  • IAM user or role with necessary permissions (see IAM Permissions)
  • Access to the AWS regions where you want to deploy

Required AWS Services

  • DynamoDB - Component and API key storage
  • AWS Secrets Manager - Configuration and API key secrets
  • CloudWatch (optional) - Metrics publishing

Quick Start

1. Basic Configuration

Add to your application.yml:

2. AWS Credentials

The Hub uses the AWS SDK default credential chain. You can provide credentials via: Environment variables:
IAM Role (recommended for EC2/ECS/EKS):
Configuration file (not recommended for production):

3. Start the Hub

The Hub will automatically:
  • Create required DynamoDB tables (if createTables: true)
  • Set up TTL for the sharables table
  • Configure multi-region replication (if configured)

DynamoDB Tables

The AWS provider creates and manages three DynamoDB tables:

Components Table

Table Name: {prefix}-components Stores Hub component definitions with versioning support. Schema:
  • Partition Key: componentName (String) - Component name
  • Sort Key: revision (Number) - Component revision
  • Attributes:
    • definition (String) - Component DSL definition
    • metadata (Map) - Component metadata
    • dependencies (List) - Component dependencies
    • connectors (List) - Required connectors
    • version (Number) - Optimistic locking version
Features:
  • Point-in-time recovery enabled
  • Versioned revisions for rollback capability
  • Optimistic locking for concurrent updates
  • Global table support for multi-region
Configuration:

API Key Lookup Table

Table Name: {prefix}-api-key-lookup Maintains a lookup index for API keys associated with components. Schema:
  • Partition Key: componentName (String) - Component name
  • Attributes:
    • secrets (Set<String>) - API key secret names
    • exposed (Boolean) - Whether component is exposed
    • exposedFunctions (List<String>) - Exposed function names
    • version (Number) - Optimistic locking version
Use Cases:
  • Fast lookup of API keys for a component
  • Determining if a component is publicly exposed
  • Managing component access control

Sharables Table

Table Name: {prefix}-sharables Stores temporary sharable tokens (e.g., for magic links, temporary access). Schema:
  • Partition Key: token (String) - Unique token
  • Attributes:
    • payload (String) - Sharable payload (JSON)
    • expiresAt (Number) - Expiration timestamp
    • expired (Boolean) - Expiration flag
    • ttl (Number) - DynamoDB TTL attribute
Features:
  • Automatic cleanup via DynamoDB TTL
  • High-performance token retrieval
  • Configurable expiration
Configuration:

AWS Secrets Manager

The AWS provider stores sensitive configuration and API keys in AWS Secrets Manager.

Component Configuration Secrets

Naming Convention: {prefix}/component-config/{configId.key}/{configId.version} Example: zenoo-hub/component-config/payment-api/1.0 Content Structure:
Features:
  • Automatic versioning with AWSCURRENT and AWSPREVIOUS stage labels
  • Multi-region replication
  • Encryption at rest with AWS KMS
  • Audit trail via CloudTrail

API Key Secrets

Naming Convention: {prefix}/api-keys/{keyName} Example: zenoo-hub/api-keys/client-api-key Content Structure:
Features:
  • Secure storage with encryption
  • Permission-based access control
  • Component-level permissions
  • Automatic rotation support (via AWS)

Configuration Reference

AWS Core Configuration

DynamoDB Configuration

Secrets Manager Configuration

CloudWatch Metrics Configuration

Multi-Region Deployment

The AWS provider supports multi-region replication for both DynamoDB and Secrets Manager.

DynamoDB Global Tables

Features:
  • Active-active replication
  • Automatic conflict resolution
  • Low-latency local reads
  • Cross-region failover
Requirements:
  • Same AWS account in all regions
  • DynamoDB streams enabled (automatic)
  • IAM permissions for global table creation

Secrets Manager Replication

Features:
  • Automatic secret replication
  • Independent KMS keys per region
  • Automatic rotation support
  • Regional failover

IAM Permissions

Minimum Required Permissions

Create an IAM policy with the following permissions:
For production deployments, also grant:
  • kms:Decrypt, kms:Encrypt - For KMS encryption
  • logs:CreateLogGroup, logs:CreateLogStream, logs:PutLogEvents - For CloudWatch Logs
  • sts:AssumeRole - For cross-account access (if needed)

Performance Tuning

DynamoDB Capacity

Choose between on-demand and provisioned capacity: On-Demand (Recommended for variable workloads):
Provisioned (For predictable workloads):

Connection Pooling

The AWS provider uses the AWS SDK’s built-in connection pooling. For high-throughput scenarios:

Caching Strategy

Enable Secrets Manager caching to reduce API calls:
Trade-offs:
  • Reduces Secrets Manager API calls (cost savings)
  • Improves latency
  • Secrets changes take up to cacheTtl to propagate

Security Best Practices

1. Use IAM Roles Instead of Access Keys

Recommended:
Avoid:

2. Enable Encryption at Rest

DynamoDB tables are encrypted by default. For additional security, use customer-managed KMS keys:

3. Use VPC Endpoints

For enhanced security, access DynamoDB and Secrets Manager via VPC endpoints:
  • Eliminates internet gateway traffic
  • Reduces data transfer costs
  • Improved security posture

4. Enable CloudTrail Audit Logging

Monitor all API calls for compliance:

5. Tag Resources Appropriately

Use tags for cost allocation and access control:

Monitoring and Metrics

CloudWatch Metrics

The AWS provider publishes the following metrics: DynamoDB Metrics:
  • DynamoDB.Operation.Latency - Operation latency by operation type
  • DynamoDB.Operation.Errors - Error count by operation type
  • DynamoDB.ThrottledRequests - Number of throttled requests
Secrets Manager Metrics:
  • SecretsManager.CacheHitRate - Cache hit percentage
  • SecretsManager.AccessCount - Secret access count
Custom Dimensions:
  • TableName - DynamoDB table name
  • Operation - Operation type (GetItem, PutItem, etc.)
  • SecretName - Secret name

CloudWatch Alarms

Set up alarms for critical metrics:

Troubleshooting

Tables Not Created

Symptom: Hub starts but tables don’t exist Solutions:
  1. Check createTables: true in configuration
  2. Verify IAM permissions include dynamodb:CreateTable
  3. Check CloudWatch Logs for errors
  4. Verify region is correct

Secret Not Found

Symptom: SecretNotFoundException when retrieving configuration Solutions:
  1. Verify secret name format: {prefix}/component-config/{key}/{version}
  2. Check IAM permissions include secretsmanager:GetSecretValue
  3. Ensure secret exists in the correct region
  4. Check secret version/stage labels

DynamoDB Throttling

Symptom: ProvisionedThroughputExceededException Solutions:
  1. Switch to on-demand billing mode
  2. Increase provisioned capacity
  3. Implement exponential backoff (already configured)
  4. Review access patterns for optimization

High Latency

Symptom: Slow component retrieval Solutions:
  1. Enable DynamoDB DAX (caching layer)
  2. Use VPC endpoints to reduce network latency
  3. Choose regions closer to your deployment
  4. Review DynamoDB table design

Connectivity Issues

Symptom: Cannot connect to DynamoDB/Secrets Manager Solutions:
  1. Check VPC security groups and NACLs
  2. Verify VPC endpoints are configured correctly
  3. Ensure DNS resolution is working
  4. Check IAM permissions

Testing with LocalStack

For local development and testing, use LocalStack to emulate AWS services:

1. Start LocalStack

2. Configure Hub for LocalStack

3. Run Tests

Cost Optimization

DynamoDB Costs

On-Demand Pricing:
  • Pay per request (recommended for variable workloads)
  • No capacity planning required
  • Cost scales with usage
Provisioned Pricing:
  • Reserve capacity (cheaper for predictable workloads)
  • Auto-scaling available
  • Pay for reserved capacity even if unused
Optimization Tips:
  • Use on-demand for development/staging
  • Use provisioned with auto-scaling for production
  • Archive old components to S3 with lifecycle policies
  • Use TTL for automatic data expiration (sharables)

Secrets Manager Costs

  • Charged per secret per month + API calls
  • Use caching to reduce API calls:
  • Consolidate secrets where appropriate

Data Transfer Costs

  • Use VPC endpoints to eliminate internet gateway charges
  • Deploy in same region as other services
  • Use multi-region replication judiciously

Migration from Old Configuration

If upgrading from an older Hub version, your existing configuration continues to work: Old Configuration (Still Supported):
New Configuration (Recommended):
Read the complete migration guide

See Also