@@ -151,6 +151,48 @@ const client = new S3Client({
151151});
152152```
153153
154+ ### AWS Profile ` profile `
155+
156+ You can set a ` profile: string ` value at the client initialization point in code.
157+
158+ ``` js
159+ // Example: setting a non-default profile for a single client.
160+ new S3Client ({
161+ profile: " my-profile"
162+ });
163+ ```
164+
165+ ``` js
166+ import { fromIni } from " @aws-sdk/credential-providers" ;
167+ // Example: setting a non-default profile affects credential resolution.
168+ // the fromIni function will use the client's designated profile if no
169+ // profile is set on the `fromIni({ profile: "..." })` function.
170+ new S3Client ({
171+ profile: " my-profile" ,
172+ credentials: fromIni ()
173+ });
174+ ```
175+
176+ ``` js
177+ import { fromIni } from " @aws-sdk/credential-providers" ;
178+ // Example: you can set different profiles for credentials and the client itself if needed.
179+ // We expect this to be rarely needed.
180+ new S3Client ({
181+ profile: " my-profile" ,
182+ credentials: fromIni ({ profile: " my-other-profile" })
183+ });
184+ ```
185+
186+ - This profile applies only to the client on which it is set, and overrides the AWS_PROFILE environment variable in that case.
187+ - Setting a profile does nothing if running in an environment that does not have an AWS configuration file, such as browsers.
188+ - Values configured in the profile will be used * unless* an overriding environment variable or code level configuration exists.
189+ - This includes fields such as ` region ` , ` retry_mode ` , ` max_attempts ` , ` use_fips_endpoint ` etc.
190+ - Different client instances may have different profiles set.
191+ - If this profile is set, and the client's credentials are resolved through the AWS configuration file, the profile will be
192+ used unless another profile is set in the credentials provider function.
193+ - Setting a profile only reads configuration from that one profile. If the profile points to another profile for e.g.
194+ ` source_profile ` credentials, the source profile is only used for credentials, and not other configuration fields.
195+
154196### Custom Endpoint ` endpoint `
155197
156198Each SDK client, by default, resolves the target endpoint with rule-based system
0 commit comments