or run

npx @tessl/cli init
Log in

Version

Tile

Overview

Evals

Files

docs

batch-operations.mdclient-configuration.mddead-letter-queues.mdindex.mdmessage-move-tasks.mdmessage-operations.mdqueue-attributes-tags.mdqueue-management.mdqueue-permissions.md
tile.json

client-configuration.mddocs/

Client Configuration

Client setup and configuration options for AWS SQS including authentication, regions, endpoints, and middleware configuration.

Capabilities

SQS Client

Main client class for AWS SQS operations with full configuration support.

/**
 * AWS SQS client providing access to Amazon Simple Queue Service
 */
class SQSClient {
  /**
   * Create new SQS client instance
   * @param configuration - Client configuration options
   */
  constructor(configuration: SQSClientConfig);
  
  /**
   * Send command to SQS service
   * @param command - SQS command to execute
   * @returns Promise resolving to command output
   */
  send<InputType, OutputType>(
    command: Command<InputType, OutputType, SQSClientResolvedConfig>
  ): Promise<OutputType>;
  
  /**
   * Clean up client resources and close connections
   */
  destroy(): void;
}

interface SQSClientConfig {
  /** AWS region for SQS operations */
  region?: string | Provider<string>;
  /** AWS credentials for authentication */
  credentials?: AwsCredentialIdentityProvider;
  /** Custom endpoint URL or configuration */
  endpoint?: string | Endpoint | Provider<Endpoint>;
  /** Custom logger for request/response logging */
  logger?: Logger;
  /** Retry strategy configuration */
  retryMode?: string | Provider<RetryMode>;
  /** Maximum number of retry attempts */
  maxAttempts?: number | Provider<number>;
  /** Custom HTTP handler for requests */
  requestHandler?: RequestHandler;
  /** Request timeout in milliseconds */
  requestTimeout?: number;
  /** Custom user agent string */
  customUserAgent?: string;
}

V2 Compatible Client

Aggregated client providing direct method access for backward compatibility.

/**
 * V2-compatible SQS client with direct method calls
 */
class SQS {
  constructor(configuration: SQSClientConfig);
  
  /** Send message using direct method call */
  sendMessage(params: SendMessageRequest): Promise<SendMessageResult>;
  /** Receive messages using direct method call */
  receiveMessage(params: ReceiveMessageRequest): Promise<ReceiveMessageResult>;
  /** Delete message using direct method call */
  deleteMessage(params: DeleteMessageRequest): Promise<void>;
  /** Create queue using direct method call */
  createQueue(params: CreateQueueRequest): Promise<CreateQueueResult>;
  /** Delete queue using direct method call */
  deleteQueue(params: DeleteQueueRequest): Promise<void>;
  /** List queues using direct method call */
  listQueues(params?: ListQueuesRequest): Promise<ListQueuesResult>;
}

Usage Examples:

import { SQSClient, SendMessageCommand } from "@aws-sdk/client-sqs";

// Basic client with region
const client = new SQSClient({ 
  region: "us-east-1" 
});

// Client with custom credentials
const clientWithCreds = new SQSClient({
  region: "us-west-2",
  credentials: {
    accessKeyId: "your-access-key",
    secretAccessKey: "your-secret-key"
  }
});

// Client with custom endpoint (for LocalStack)
const localClient = new SQSClient({
  region: "us-east-1",
  endpoint: "http://localhost:4566"
});

// Client with retry configuration
const resilientClient = new SQSClient({
  region: "us-east-1",
  retryMode: "adaptive",
  maxAttempts: 5
});

// V2 compatible usage
import * as AWS from "@aws-sdk/client-sqs";
const v2Client = new AWS.SQS({ region: "us-east-1" });
const result = await v2Client.sendMessage({
  QueueUrl: "https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue",
  MessageBody: "Hello World"
});

Configuration Types

Core configuration interfaces and types for client setup.

interface Endpoint {
  protocol?: string;
  hostname?: string;
  port?: number;
  path?: string;
}

interface Provider<T> {
  (): Promise<T>;
}

interface AwsCredentialIdentityProvider extends Provider<AwsCredentialIdentity> {}

interface AwsCredentialIdentity {
  accessKeyId: string;
  secretAccessKey: string;
  sessionToken?: string;
}

interface Logger {
  trace?: (content: any) => void;
  debug?: (content: any) => void;
  info?: (content: any) => void;
  warn?: (content: any) => void;
  error?: (content: any) => void;
}

type RetryMode = "legacy" | "standard" | "adaptive";

interface RequestHandler {
  handle(request: any, options?: any): Promise<any>;
}

Regional Endpoints

The client automatically uses the appropriate regional SQS endpoint based on the configured region. Standard AWS regions are supported:

  • US East (N. Virginia): us-east-1
  • US West (Oregon): us-west-2
  • Europe (Ireland): eu-west-1
  • Asia Pacific (Tokyo): ap-northeast-1
  • And all other AWS regions

For custom endpoints (like LocalStack or custom SQS implementations), use the endpoint configuration option.

Authentication

The client supports multiple authentication methods:

  1. Environment Variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY
  2. AWS Credentials File: ~/.aws/credentials
  3. IAM Roles: For EC2 instances and Lambda functions
  4. Temporary Credentials: STS assume role
  5. Explicit Credentials: Passed directly to client constructor

Error Handling

Client configuration errors throw synchronous exceptions during construction, while service operation errors are returned as rejected promises.

try {
  const client = new SQSClient({ region: "invalid-region" });
  await client.send(command);
} catch (error) {
  console.error("Operation failed:", error.message);
  console.log("Request ID:", error.$metadata?.requestId);
}