🌐
npm
npmjs.com › package › @aws-sdk › client-s3
aws-sdk/client-s3
6 days ago - The aggregated client class is exported from the same package, but without the "Client" suffix. S3 extends S3Client and additionally supports all operations, waiters, and paginators as methods. This style may be familiar to you from the AWS SDK for JavaScript v2.
      » npm install @aws-sdk/client-s3
    
Published   Apr 17, 2026
Version   3.1032.0
🌐
AWS
docs.aws.amazon.com › aws sdk for java › developer guide for version 2.x › calling aws services from the aws sdk for java 2.x › work with amazon s3
Work with Amazon S3 - AWS SDK for Java 2.x
From version 2.18.x and onward, the AWS SDK for Java 2.x uses virtual hosted-style addressing when including an endpoint override. This applies as long as the bucket name is a valid DNS label. ... method with true in your client builder to force the client to use path-style addressing for buckets. The following example shows a service client configured with an endpoint override and using path-style addressing. S3Client client = S3Client.builder() .region(Region.US_WEST_2) .endpointOverride(URI.create("https://s3.us-west-2.amazonaws.com")) .forcePathStyle(true) .build();
Discussions

amazon web services - How to set credentials in AWS SDK v3 JavaScript? - Stack Overflow
I was able to use this pattern ... aws js-sdk v3. 2023-12-11T16:13:03.283Z+00:00 ... This answer is basically the same as what's been said above, but for anyone who's migrating from v2 to v3 and not moving to the new modular model, you will find that your existing clients don't immediately work, because the expected credentials format is different. If you previously had… · new AWS.CloudWatch({ ... More on stackoverflow.com
🌐 stackoverflow.com
Safe way to use aws-sdk lib on client side
Never trust the client-side! If the client side is the one making the connection to your private S3 bucket, then your credentials are also available for the client so that is not a secure way to do it. Your use case allows for all users of the app to access the file, so why don't you make your S3 bucket publically accessible either through Cloudfront or directly? More on reddit.com
🌐 r/aws
11
2
March 8, 2024
"@aws-sdk/client-s3" without exposing keys and bucket name?
I don't know too much about TypeScript so I cannot comment on the implementation, but in general, bucket name is like a phone number or an address, you should always treat it as known by others (even hackers). You can use AssumeRole to get temporary access key, secret and token, you can setup a subset of permission attached to the role itself, and those credentials always have a TTL. https://docs.aws.amazon.com/STS/latest/APIReference/API_AssumeRole.html More on reddit.com
🌐 r/aws
2
3
January 6, 2022
Question: Typescript import aws-sdk
import * as AWS from 'aws-sdk'; does the trick for me. More on reddit.com
🌐 r/aws
2
3
March 11, 2018
🌐
GitHub
github.com › aws › aws-sdk-js-v3
GitHub - aws/aws-sdk-js-v3: Modularized AWS SDK for JavaScript. · GitHub
March 7, 2026 - These are javascript specific libraries that wrap client operations to make them easier to work with. Popular examples are @aws-sdk/lib-dynamodb which simplifies working with items in Amazon DynamoDB or @aws-sdk/lib-storage which exposes the Upload function and simplifies parallel uploads in S3's multipartUpload.
Starred by 3.6K users
Forked by 677 users
Languages   TypeScript 96.0% | JavaScript 3.8% | Java 0.2% | Smithy 0.0% | Makefile 0.0% | Objective-C 0.0%
🌐
Medium
medium.com › @claude.ducharme › 3-aws-sdk-for-javascript-v3-examples-using-typescript-c1e1ab209ec6
3 AWS SDK for JavaScript v3 examples using TypeScript | by Claude Ducharme | Medium
August 1, 2022 - TypeScript code samples for client-s3 (GetObjectCommand & SelectObjectContentCommand) and client-sqs (ReceiveMessageCommand)
🌐
AWS
docs.aws.amazon.com › sdk-for-ruby › v3 › api › Aws › S3 › Client.html
Class: Aws::S3::Client — AWS SDK for Ruby V3
standard - A standardized set of retry rules across the AWS SDKs. This includes support for retry quotas, which limit the number of unsuccessful retries a client can make. adaptive - An experimental retry mode that includes all the functionality of standard mode along with automatic client side throttling. This is a provisional mode that may change behavior in the future. :s3_disable_multiregion_access_points (Boolean) — default: false —
Find elsewhere
🌐
AWS
sdk.amazonaws.com › java › api › latest › software › amazon › awssdk › services › s3 › S3Client.html
S3Client (AWS SDK for Java - 2.42.37)
@Generated("software.amazon.awssdk:codegen") @SdkPublicApi @ThreadSafe public interface S3Client extends AwsClient · Service client for accessing Amazon S3. This can be created using the static builder() method. Fields · Modifier and Type · Field · Description ·
🌐
AWS
docs.aws.amazon.com › aws sdk for javascript › developer guide for sdk version 3 › sdk for javascript (v3) code examples › amazon s3 examples using sdk for javascript (v3)
Amazon S3 examples using SDK for JavaScript (v3) - AWS SDK for JavaScript
For API details, see CopyObject in AWS SDK for JavaScript API Reference. The following code example shows how to use CreateBucket. ... There's more on GitHub. Find the complete example and learn how to set up and run in the AWS Code Examples Repository ... Create the bucket. import { BucketAlreadyExists, BucketAlreadyOwnedByYou, CreateBucketCommand, S3Client, waitUntilBucketExists, } from "@aws-sdk/client-s3"; /** * Create an Amazon S3 bucket.
🌐
Amazon Web Services
docs.amazonaws.cn › 亚马逊云科技 › amazon sdk for javascript › developer guide for sdk version 3 › get started with the amazon sdk for javascript › get started with node.js
Get started with Node.js - Amazon SDK for JavaScript
For example // `new S3Client({ region: 'us-east-1', credentials: {...} })` would //initialize the client with those settings. However, the SDK will // use your local configuration and credentials if those properties // are not defined here. const s3Client = new S3Client({}); // Create an Amazon S3 bucket. The epoch timestamp is appended // to the name to make it unique. const bucketName = `test-bucket-${Date.now()}`; await s3Client.send( new CreateBucketCommand({ Bucket: bucketName, }), ); // Put an object into an Amazon S3 bucket.
🌐
DEV Community
dev.to › frehner › javascript-aws-sdk-v3-s3-guide-dg5
Javascript AWS SDK v3 S3 guide - DEV Community
August 20, 2021 - The major difference is that you now import/require a very bare "client", and send your commands through that client. // The "old" way const { S3 } = require('awk-sdk') const s3 = new S3(s3Config) const object = await s3.getObject(objConfig).promise()
🌐
Go Packages
pkg.go.dev › github.com › aws › aws-sdk-go › service › s3
s3 package - github.com/aws/aws-sdk-go/service/s3 - Go Packages
github.com/aws/aws-sdk-go · Open Source Insights · Code Wiki · Using the Client · Upload Managers · Download Manager · Automatic URI cleaning · Get Bucket Region · S3 Crypto Client · Package s3 provides the client and types for making API requests to Amazon Simple Storage Service.
🌐
AWS
docs.aws.amazon.com › aws sdk for java › developer guide for version 2.x › migrate from version 1.x to 2.x of the aws sdk for java › what's different between the aws sdk for java 1.x and 2.x › changes in working with amazon s3 from version 1 to version 2 of the aws sdk for java › s3 client differences between version 1 and version 2 of the aws sdk for java
S3 client differences between version 1 and version 2 of the AWS SDK for Java - AWS SDK for Java 2.x
The default Content-Type header value for the following methods differ as shown in the following table. // SDK V1 AmazonS3 s3ClientV1 = AmazonS3ClientBuilder.standard().build(); s3ClientV1.setRegion(Region.getRegion(Regions.US_WEST_2)); // SDK V2 S3Client s3ClientV2 = S3Client.builder() .region(Region.US_WEST_2) .build(); Instead of using a single S3ClientOptions object with the setS3ClientOptions method, V2 provides methods on the client builder to set options.
Top answer
1 of 4
65

There is a credential chain that provides credentials to your API calls from the SDK https://docs.aws.amazon.com/sdk-for-javascript/v3/developer-guide/setting-credentials-node.html

Loaded from AWS Identity and Access Management (IAM) roles for Amazon EC2

Loaded from the shared credentials file (~/.aws/credentials)

Loaded from environment variables

Loaded from a JSON file on disk

Other credential-provider classes provided by the JavaScript SDK

You can embed the credential inside your source code but it's not the prefered way

new S3Client(configuration: S3ClientConfig): S3Client

Where S3ClientConfig contain a credentials property

https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/modules/credentials.html

    const { S3Client,GetObjectCommand } = require("@aws-sdk/client-s3");
    
    let client = new S3Client({
        region:'ap-southeast-1',
        credentials:{
            accessKeyId:'',
            secretAccessKey:''
        }
    });
    
    (async () => {
      const response = await client.send(new GetObjectCommand({Bucket:"BucketNameHere",Key:"ObjectNameHere"}));
      console.log(response);
    })();

Sample answer

  '$metadata': {
    httpStatusCode: 200,
    requestId: undefined,
    extendedRequestId: '7kwrFkEp3lEnLU+OtxjrgdmS6gQmvPdbnqqR7I8P/rdFrUPBkdKYPYykWivuHPXCF1IHgjCIbe8=',
    cfId: undefined,
    attempts: 1,
    totalRetryDelay: 0
  },
2 of 4
13

Here's a simple approach I use (in Deno) for testing (in case you don't want to go the signedUrl approach and just let the SDK do the heavy lifting for you):

import { config as env } from 'https://deno.land/x/dotenv/mod.ts' // https://github.com/pietvanzoen/deno-dotenv
import { S3Client, ListObjectsV2Command } from 'https://cdn.skypack.dev/@aws-sdk/client-s3' // https://github.com/aws/aws-sdk-js-v3

const {AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY} = env()

// https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/modules/credentials.html
const credentials = {
    accessKeyId: AWS_ACCESS_KEY_ID,
    secretAccessKey: AWS_SECRET_ACCESS_KEY,
}

// https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/s3clientconfig.html
const config = {
    region: 'ap-southeast-1',
    credentials,
}

// https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/classes/s3client.html
const client = new S3Client(config)

export async function list() {
    // https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/interfaces/listobjectsv2commandinput.html
    const input = {
        Bucket: 'BucketNameHere'
    }

    // https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/classes/command.html
    const cmd = new ListObjectsV2Command(input)
    
    // https://docs.aws.amazon.com/AWSJavaScriptSDK/v3/latest/clients/client-s3/classes/listobjectsv2command.html
    return await client.send(cmd)
}