CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/npm-aws-sdk--client-sts

AWS SDK for JavaScript STS Client for Node.js, Browser and React Native, providing temporary security credentials and role assumption capabilities

92

1.05x

Evaluation92%

1.05x

Agent success when using this tile

Overview
Eval results
Files

task.mdevals/scenario-8/

Resilient AWS API Client

Build a client that calls AWS STS operations with automatic retry capabilities to handle transient failures.

Background

Cloud services occasionally experience transient failures like throttling or temporary unavailability. Your client should handle these gracefully with automatic retries and exponential backoff.

Capabilities

Client Configuration

Create a function that initializes an STS client with retry settings:

  • Configure the retry mode to use exponential backoff
  • Set a custom maximum number of retry attempts
  • Specify the AWS region

Identity Retrieval

Create a function that retrieves the caller's AWS account ID:

  • Call the GetCallerIdentity operation using the client
  • Extract and return the account ID from the response

Test Cases

  • When configured with standard retry mode and maxAttempts of 5, the client retries throttling errors up to 5 times @test
  • When configured with maxAttempts of 3, the client stops retrying after 3 attempts @test
  • On a successful API call, the getAccountId function returns the correct account ID @test

Implementation

@generates

API

export interface RetryConfig {
  region: string;
  maxAttempts: number;
  retryMode: string;
}

export function createClient(config: RetryConfig): any;

export async function getAccountId(client: any): Promise<string>;

Dependencies { .dependencies }

@aws-sdk/client-sts { .dependency }

Provides AWS STS client operations with built-in retry and exponential backoff support.

Install with Tessl CLI

npx tessl i tessl/npm-aws-sdk--client-sts

tile.json