DynamoDB
DynamoDB Data Connector Documentation
Amazon DynamoDB is a fully managed NoSQL database service that provides fast and predictable performance with seamless scalability. This connector enables using DynamoDB tables as data sources for federated SQL queries in Spice.
Configuration
from
from
The from
field should specify the DynamoDB table name:
from
Description
dynamodb:table
Read data from a DynamoDB table named table
If an expected table is not found, verify the dynamodb_aws_region
parameter. DynamoDB tables are region-specific.
name
name
The dataset name. This will be used as the table name within Spice.
Example:
params
params
The DynamoDB data connector supports the following configuration parameters:
dynamodb_aws_region
Required. The AWS region containing the DynamoDB table
dynamodb_aws_access_key_id
Optional. AWS access key ID for authentication. If not provided, credentials will be loaded from environment variables or IAM roles
dynamodb_aws_secret_access_key
Optional. AWS secret access key for authentication. If not provided, credentials will be loaded from environment variables or IAM roles
dynamodb_aws_session_token
Optional. AWS session token for authentication
Credential Sources
If AWS credentials are not explicitly provided in the configuration, the connector will automatically load credentials from the following sources in order:
Environment Variables:
AWS_ACCESS_KEY_ID
andAWS_SECRET_ACCESS_KEY
AWS_SESSION_TOKEN
(if using temporary credentials)
Shared AWS Config/Credentials Files:
Config file:
~/.aws/config
(Linux/Mac) or%UserProfile%\.aws\config
(Windows)Credentials file:
~/.aws/credentials
(Linux/Mac) or%UserProfile%\.aws\credentials
(Windows)The
AWS_PROFILE
environment variable can be used to specify a named profile.Supports both static credentials and SSO sessions
Example credentials file:
To set up SSO authentication:
Run
aws configure sso
to configure a new SSO profileUse the profile by setting
AWS_PROFILE=sso-profile
Run
aws sso login
to start a new SSO session
Web Identity Token Credentials:
Used primarily with OpenID Connect (OIDC) and OAuth
Common in Kubernetes environments using IAM roles for service accounts (IRSA)
ECS Container Credentials:
Used when running in Amazon ECS containers
Automatically uses the task's IAM role
Retrieved from the ECS credential provider endpoint
EC2 Instance Metadata Service (IMDSv2):
Used when running on EC2 instances
Automatically uses the instance's IAM role
Retrieved securely using IMDSv2
The connector will try each source in order until valid credentials are found. If no valid credentials are found, an authentication error will be returned.
IAM Permissions Regardless of the credential source, the IAM role or user must have appropriate DynamoDB permissions (e.g., dynamodb:Scan
, dynamodb:DescribeTable
) to access the table.
Required IAM Permissions
The IAM role or user needs the following permissions to access DynamoDB tables:
Permission Details
dynamodb:Scan
Required. Allows reading all items from the table
dynamodb:DescribeTable
Required. Allows fetching table metadata and schema information
Example IAM Policies
Minimal Policy (Read-only access to specific table)
Access to Multiple Tables
Access to All Tables in a Region
Security Considerations
Avoid using
dynamodb:*
permissions as it grants more access than necessary.Consider using more restrictive policies in production environments.
When using IAM roles with EKS, ensure the service account is properly configured with IRSA.
Examples
Basic Configuration with Environment Credentials
Configuration with Explicit Credentials
Querying Nested Structures
DynamoDB supports complex nested JSON structures. These fields can be queried using SQL:
Limitations
The DynamoDB connector currently does not support filter push-down optimization. All filtering is performed after data is retrieved from DynamoDB.
Primary key optimizations are not yet implemented - retrieving items by their primary key will still scan the table.
The DynamoDB connector will scan the first 10 items to determine the schema of the table. This may miss columns that are not present in the first 10 items.
Data Types
The DynamoDB connector supports the following data types and mappings:
Basic scalar types (String, Number, Boolean)
Lists and Maps
Nested structures
Binary data
Example schema from a users table:
Performance Considerations
Due to limited support for filter push-down, enable acceleration to prevent scanning the entire table on every query.
Last updated
Was this helpful?