Debian Codegraph @

docs/source/guide/configuration.rst

raw
1 .. _guide_configuration:
2
3 Configuration
4 =============
5
6 Overview
7 ---------
8 Boto3 looks at various configuration locations until it finds configuration values. Boto3 adheres to the following lookup order when searching through sources for configuration values:
9
10 * A ``Config`` object that's created and passed as the ``config`` parameter when creating a client
11 * Environment variables
12 * The ``~/.aws/config`` file
13
14 .. note::
15
16 Configurations are not wholly atomic. This means configuration values set in your AWS config file can be singularly overwritten by setting a specific environment variable or through the use of a ``Config`` object.
17
18 For details about credential configuration, see the :ref:`guide_credentials` guide.
19
20
21 Using the Config object
22 -----------------------
23 This option is for configuring client-specific configurations that affect the behavior of your specific client object only. As described earlier, there are options used here that will supersede those found in other configuration locations:
24
25 * ``region_name`` (string) - The AWS Region used in instantiating the client. If used, this takes precedence over environment variable and configuration file values. But it doesn't overwrite a ``region_name`` value *explicitly* passed to individual service methods.
26 * ``signature_version`` (string) - The signature version used when signing requests. Note that the default version is Signature Version 4. If you're using a presigned URL with an expiry of greater than 7 days, you should specify Signature Version 2.
27 * ``s3`` (related configurations; dictionary) - Amazon S3 service-specific configurations. For more information, see the `Botocore config reference <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html>`_.
28 * ``proxies`` (dictionary) - Each entry maps a protocol name to the proxy server Boto3 should use to communicate using that protocol. See :ref:`specify_proxies` for more information.
29 * ``proxies_config`` (dictionary) - Additional proxy configuration settings. For more information, see :ref:`configure_proxies`.
30 * ``retries`` (dictionary) - Client retry behavior configuration options that include retry mode and maximum retry attempts. For more information, see the :ref:`guide_retries` guide.
31
32
33 For more information about additional options, or for a complete list of options, see the `Config reference <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html>`_.
34
35 To set these configuration options, create a ``Config`` object with the options you want, and then pass them into your client.
36
37 .. code-block:: python
38
39 import boto3
40 from botocore.config import Config
41
42 my_config = Config(
43 region_name = 'us-west-2',
44 signature_version = 'v4',
45 retries = {
46 'max_attempts': 10,
47 'mode': 'standard'
48 }
49 )
50
51 client = boto3.client('kinesis', config=my_config)
52
53
54 Using proxies
55 ~~~~~~~~~~~~~
56 With Boto3, you can use proxies as intermediaries between your code and AWS. Proxies can provide functions such as filtering, security, firewalls, and privacy assurance.
57
58 .. _specify_proxies:
59
60 Specifying proxy servers
61 ''''''''''''''''''''''''
62
63 You can specify proxy servers to be used for connections when using specific protocols. The ``proxies`` option in the ``Config`` object is a dictionary in which each entry maps a protocol to the address and port number of the proxy server for that protocol.
64
65 In the following example, a proxy list is set up to use ``proxy.amazon.com``, port 6502 as the proxy for all HTTP requests by default. HTTPS requests use port 2010 on ``proxy.amazon.org`` instead.
66
67
68 .. code-block:: python
69
70 import boto3
71 from botocore.config import Config
72
73 proxy_definitions = {
74 'http': 'http://proxy.amazon.com:6502',
75 'https': 'https://proxy.amazon.org:2010'
76 }
77
78 my_config = Config(
79 region_name='us-east-2',
80 signature_version='v4',
81 proxies=proxy_definitions
82 )
83
84 client = boto3.client('kinesis', config=my_config)
85
86 Alternatively, you can use the ``HTTP_PROXY`` and ``HTTPS_PROXY`` environment variables to specify proxy servers. Proxy servers specified using the ``proxies`` option in the ``Config`` object will override proxy servers specified using environment variables.
87
88 .. _configure_proxies:
89
90 Configuring proxies
91 '''''''''''''''''''
92 You can configure how Boto3 uses proxies by specifying the ``proxies_config`` option, which is a dictionary that specifies the values of several proxy options by name. There are three keys in this dictionary: ``proxy_ca_bundle``, ``proxy_client_cert``, and ``proxy_use_forwarding_for_https``. For more information about these keys, see the `Botocore config reference <https://botocore.amazonaws.com/v1/documentation/api/latest/reference/config.html#botocore.config.Config>`_.
93
94 .. code-block:: python
95
96 import boto3
97 from botocore.config import Config
98
99 proxy_definitions = {
100 'http': 'http://proxy.amazon.com:6502',
101 'https': 'https://proxy.amazon.org:2010'
102 }
103
104 my_config = Config(
105 region_name='us-east-2',
106 signature_version='v4',
107 proxies=proxy_definitions,
108 proxies_config={
109 'proxy_client_cert': '/path/of/certificate'
110 }
111 )
112
113 client = boto3.client('kinesis', config=my_config)
114
115 With the addition of the ``proxies_config`` option shown here, the proxy will use the specified certificate file for authentication when using the HTTPS proxy.
116
117 Using client context parameters
118 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
119 Some services have configuration settings that are specific to their clients. These settings are called client context parameters. Please refer to the ``Client Context Parameters`` section of a service client's documentation for a list of available parameters and information on how to use them.
120
121 .. _configure_client_context:
122
123 Configuring client context parameters
124 '''''''''''''''''''''''''''''''''''''
125 You can configure client context parameters by passing a dictionary of key-value pairs to the ``client_context_params`` parameter in your ``Config``. Invalid parameter values or parameters that are not modeled by the service will be ignored.
126
127 .. code-block:: python
128
129 import boto3
130 from botocore.config import Config
131
132 my_config = Config(
133 region_name='us-east-2',
134 client_context_params={
135 'my_great_context_param': 'foo'
136 }
137 )
138
139 client = boto3.client('kinesis', config=my_config)
140
141 Boto3 does not support setting ``client_context_params`` per request. Differing configurations will require creation of a new client.
142
143 Using environment variables
144 ---------------------------
145 You can set configuration settings using system-wide environment variables. These configurations are global and will affect all clients created unless you override them with a ``Config`` object.
146
147 .. note::
148 Only the configuration settings listed below can be set using environment variables.
149
150
151 ``AWS_ACCESS_KEY_ID``
152 The access key for your AWS account.
153
154 ``AWS_SECRET_ACCESS_KEY``
155 The secret key for your AWS account.
156
157 ``AWS_SESSION_TOKEN``
158 The session key for your AWS account. This is only needed when
159 you are using temporary credentials. The ``AWS_SECURITY_TOKEN``
160 environment variable can also be used, but is only supported
161 for backward-compatibility purposes. ``AWS_SESSION_TOKEN`` is
162 supported by multiple AWS SDKs in addition to Boto3.
163
164 ``AWS_DEFAULT_REGION``
165 The default AWS Region to use, for example, ``us-west-1`` or ``us-west-2``.
166
167 ``AWS_PROFILE``
168 The default profile to use, if any. If no value is specified, Boto3
169 attempts to search the shared credentials file and the config file
170 for the ``default`` profile.
171
172 ``AWS_CONFIG_FILE``
173 The location of the config file used by Boto3. By default this
174 value is ``~/.aws/config``. You only need to set this variable if
175 you want to change this location.
176
177 ``AWS_SHARED_CREDENTIALS_FILE``
178 The location of the shared credentials file. By default this value
179 is ``~/.aws/credentials``. You only need to set this variable if
180 you want to change this location.
181
182 ``BOTO_CONFIG``
183 The location of the Boto2 credentials file. This is not set by default.
184 You only need to set this variable if you want to use credentials stored in
185 Boto2 format in a location other than ``/etc/boto.cfg`` or ``~/.boto``.
186
187 ``AWS_CA_BUNDLE``
188 The path to a custom certificate bundle to use when establishing
189 SSL/TLS connections. Boto3 includes a CA bundle that it
190 uses by default, but you can set this environment variable to use
191 a different CA bundle.
192
193 ``AWS_METADATA_SERVICE_TIMEOUT``
194 The number of seconds before a connection to the instance metadata
195 service should time out. When attempting to retrieve credentials
196 on an Amazon EC2 instance that is configured with an IAM role,
197 a connection to the instance metadata service will time out after
198 1 second by default. If you know you're running on an EC2 instance
199 with an IAM role configured, you can increase this value if needed.
200
201 ``AWS_METADATA_SERVICE_NUM_ATTEMPTS``
202 When attempting to retrieve credentials on an Amazon EC2 instance that has
203 been configured with an IAM role, Boto3 will make only one attempt
204 to retrieve credentials from the instance metadata service before
205 giving up. If you know your code will be running on an EC2 instance,
206 you can increase this value to make Boto3 retry multiple times
207 before giving up.
208
209 ``AWS_DATA_PATH``
210 A list of **additional** directories to check when loading botocore data.
211 You typically don't need to set this value. There are two built-in search
212 paths: ``<botocoreroot>/data/`` and ``~/.aws/models``. Setting this
213 environment variable indicates additional directories to check first before
214 falling back to the built-in search paths. Multiple entries should be
215 separated with the ``os.pathsep`` character, which is ``:`` on Linux and
216 ``;`` on Windows.
217
218 ``AWS_STS_REGIONAL_ENDPOINTS``
219 Sets AWS STS endpoint resolution logic. See the ``sts_regional_endpoints``
220 configuration file section for more information on how to use this.
221
222 ``AWS_MAX_ATTEMPTS``
223 The total number of attempts made for a single request. For more information,
224 see the ``max_attempts`` configuration file section.
225
226 ``AWS_RETRY_MODE``
227 Specifies the types of retries the SDK will use. For more information,
228 see the ``retry_mode`` configuration file section.
229
230 ``AWS_SDK_UA_APP_ID``
231 AppId is an optional application specific identifier that can be set.
232 When set it will be appended to the User-Agent header of every request
233 in the form of App/{AppId}.
234
235 ``AWS_SIGV4A_SIGNING_REGION_SET``
236 A comma-delimited list of regions to sign when signing with SigV4a. For more
237 information, see the ``sigv4a_signing_region_set`` configuration file section.
238
239 ``AWS_REQUEST_CHECKSUM_CALCULATION``
240 Determines when a checksum will be calculated for request payloads. For more
241 information, see the ``request_checksum_calculation`` configuration file section.
242
243
244 ``AWS_RESPONSE_CHECKSUM_VALIDATION``
245 Determines when checksum validation will be performed on response payloads. For more
246 information, see the ``response_checksum_validation`` configuration file section.
247
248
249 Using a configuration file
250 --------------------------
251
252 Boto3 will also search the ``~/.aws/config`` file when looking for
253 configuration values. You can change the location of this file by
254 setting the ``AWS_CONFIG_FILE`` environment variable.
255
256 This file is an INI-formatted file that contains at least one
257 section: ``[default]``. You can create multiple profiles (logical
258 groups of configuration) by creating sections named ``[profile profile-name]``.
259 If your profile name has spaces, you need to surround this value with quotation marks:
260 ``[profile "my profile name"]``. The following are all the config variables supported
261 in the ``~/.aws/config`` file.
262
263 ``api_versions``
264 Specifies the API version to use for a particular AWS service.
265
266 The ``api_versions`` settings are nested configuration values that require special
267 formatting in the AWS configuration file. If the values are set by the
268 AWS CLI or programmatically by an SDK, the formatting is handled
269 automatically. If you set them by manually editing the AWS configuration
270 file, the following is the required format. Notice the indentation of each
271 value.
272 ::
273
274 [default]
275 region = us-east-1
276 api_versions =
277 ec2 = 2015-03-01
278 cloudfront = 2015-09-17
279
280 ``aws_access_key_id``
281 The access key to use.
282 ``aws_secret_access_key``
283 The secret access key to use.
284 ``aws_session_token``
285 The session token to use. This is typically needed only when using
286 temporary credentials. Note ``aws_security_token`` is supported for
287 backward compatibility.
288 ``ca_bundle``
289 The CA bundle to use. For more information, see the previous description
290 of the ``AWS_CA_BUNDLE`` environment variable.
291 ``credential_process``
292 Specifies an external command to run to generate or retrieve
293 authentication credentials. For more information,
294 see `Sourcing credentials with an external process`_.
295 ``credential_source``
296 To invoke an AWS service from an Amazon EC2 instance, you can use
297 an IAM role attached to either an EC2 instance profile or an Amazon ECS
298 container. In such a scenario, use the ``credential_source`` setting to
299 specify where to find the credentials.
300
301 The ``credential_source`` and ``source_profile`` settings are mutually
302 exclusive.
303
304 The following values are supported.
305
306 ``Ec2InstanceMetadata``
307 Use the IAM role attached to the Amazon EC2 instance profile.
308
309 ``EcsContainer``
310 Use the IAM role attached to the Amazon ECS container.
311
312 ``Environment``
313 Retrieve the credentials from environment variables.
314
315 ``duration_seconds``
316 The length of time in seconds of the role session. The value can range
317 from 900 seconds (15 minutes) to the maximum session duration setting
318 for the role. The default value is 3600 seconds (one hour).
319 ``external_id``
320 Unique identifier to pass when making ``AssumeRole`` calls.
321 ``metadata_service_timeout``
322 The number of seconds before timing out when retrieving data from the
323 instance metadata service. For more information, see the previous documentation on
324 ``AWS_METADATA_SERVICE_TIMEOUT``.
325 ``metadata_service_num_attempts``
326 The number of attempts to make before giving up when retrieving data from
327 the instance metadata service. For more information, see the previous documentation on
328 ``AWS_METADATA_SERVICE_NUM_ATTEMPTS``.
329 ``mfa_serial``
330 Serial number of the Amazon Resource Name (ARN) of a multi-factor authentication (MFA) device to use when assuming a role.
331 ``parameter_validation``
332 Disable parameter validation (default is true, parameters are
333 validated). This is a Boolean value that
334 is either ``true`` or ``false``. Whenever you make an
335 API call using a client, the parameters you provide are run through
336 a set of validation checks, including (but not limited to) required
337 parameters provided, type checking, no unknown parameters,
338 minimum length checks, and so on. Typically, you should leave parameter
339 validation enabled.
340 ``region``
341 The default AWS Region to use, for example, ``us-west-1`` or ``us-west-2``. When
342 specifying a Region inline during client initialization, this property
343 is named ``region_name``.
344 ``role_arn``
345 The ARN of the role you want to assume.
346 ``role_session_name``
347 The role name to use when assuming a role. If this value is not
348 provided, a session name will be automatically generated.
349 ``web_identity_token_file``
350 The path to a file that contains an OAuth 2.0 access token or OpenID
351 Connect ID token that is provided by the identity provider. The contents of
352 this file will be loaded and passed as the ``WebIdentityToken`` argument to
353 the ``AssumeRoleWithWebIdentity`` operation.
354 ``s3``
355 Set Amazon S3-specific configuration data. Typically, these values do not need
356 to be set.
357
358 The ``s3`` settings are nested configuration values that require special
359 formatting in the AWS configuration file. If the values are set by the
360 AWS CLI or programmatically by an SDK, the formatting is handled
361 automatically. If you set them manually by editing the AWS configuration
362 file, the following is the required format. Notice the indentation of each
363 value.
364 ::
365
366 [default]
367 region = us-east-1
368 s3 =
369 addressing_style = path
370 signature_version = s3v4
371
372 * ``addressing_style``: The S3 addressing style. When necessary, Boto
373 automatically switches the addressing style to an appropriate value.
374 The following values are supported.
375
376 ``auto``
377 (Default) Attempts to use ``virtual``, but falls back to ``path``
378 if necessary.
379
380 ``path``
381 Bucket name is included in the URI path.
382
383 ``virtual``
384 Bucket name is included in the hostname.
385
386 * ``payload_signing_enabled``: Specifies whether to include an SHA-256
387 checksum with Amazon Signature Version 4 payloads. Valid settings are
388 ``true`` or ``false``.
389
390 For streaming uploads (``UploadPart`` and ``PutObject``) that use HTTPS
391 and include a ``content-md5`` header, this setting is disabled by default.
392 * ``signature_version``: The AWS signature version to use when signing
393 requests. When necessary, Boto automatically switches the signature
394 version to an appropriate value. The following values are recognized.
395
396 ``s3v4``
397 (Default) Signature Version 4
398
399 ``s3``
400 (Deprecated) Signature Version 2
401
402 * ``use_accelerate_endpoint``: Specifies whether to use the Amazon S3 Accelerate
403 endpoint. The bucket must be enabled to use S3 Accelerate. Valid settings
404 are ``true`` or ``false``. Default: ``false``
405
406 Either ``use_accelerate_endpoint`` or ``use_dualstack_endpoint`` can be
407 enabled, but not both.
408 * ``use_dualstack_endpoint``: Specifies whether to direct all Amazon S3
409 requests to the dual IPv4/IPv6 endpoint for the configured Region. Valid
410 settings are ``true`` or ``false``. Default: ``false``
411
412 Either ``use_accelerate_endpoint`` or ``use_dualstack_endpoint`` can be
413 enabled, but not both.
414 ``source_profile``
415 The profile name that contains credentials to use for the initial
416 ``AssumeRole`` call.
417
418 The ``credential_source`` and ``source_profile`` settings are mutually
419 exclusive.
420
421 ``sts_regional_endpoints``
422 Sets AWS STS endpoint resolution logic. This configuration can also be set
423 using the environment variable ``AWS_STS_REGIONAL_ENDPOINTS``. By default,
424 this configuration option is set to ``regional``. Valid values are the following:
425
426 * ``regional``
427 Uses the STS endpoint that corresponds to the configured Region. For
428 example, if the client is configured to use ``us-west-2``, all calls
429 to STS will be made to the ``sts.us-west-2.amazonaws.com`` regional
430 endpoint instead of the global ``sts.amazonaws.com`` endpoint.
431
432 * ``legacy``
433 Uses the global STS endpoint, ``sts.amazonaws.com``, for the following
434 configured Regions:
435
436 * ``ap-northeast-1``
437 * ``ap-south-1``
438 * ``ap-southeast-1``
439 * ``ap-southeast-2``
440 * ``aws-global``
441 * ``ca-central-1``
442 * ``eu-central-1``
443 * ``eu-north-1``
444 * ``eu-west-1``
445 * ``eu-west-2``
446 * ``eu-west-3``
447 * ``sa-east-1``
448 * ``us-east-1``
449 * ``us-east-2``
450 * ``us-west-1``
451 * ``us-west-2``
452
453 All other Regions will use their respective regional endpoint.
454
455 ``tcp_keepalive``
456 Toggles the TCP Keep-Alive socket option used when creating connections.
457 By default this value is ``false``; TCP Keepalive will not be used
458 when creating connections. To enable TCP Keepalive with the system default configurations,
459 set this value to ``true``.
460
461 ``max_attempts``
462 An integer representing the maximum number of attempts that will be made for
463 a single request, including the initial attempt. For example,
464 setting this value to 5 will result in a request being retried up to
465 4 times. If not provided, the number of retries will default to whatever
466 is modeled, which is typically 5 total attempts in the ``legacy`` retry mode,
467 and 3 in the ``standard`` and ``adaptive`` retry modes.
468
469 ``retry_mode``
470 A string representing the type of retries Boto3 will perform. Valid values are the following:
471
472 * ``legacy`` - The preexisting retry behavior. This is the default value if
473 no retry mode is provided.
474 * ``standard`` - A standardized set of retry rules across the AWS SDKs.
475 This includes a standard set of errors that are retried and
476 support for retry quotas, which limit the number of unsuccessful retries
477 an SDK can make. This mode will default the maximum number of attempts
478 to 3 unless a ``max_attempts`` is explicitly provided.
479 * ``adaptive`` - An experimental retry mode that includes all the
480 functionality of ``standard`` mode with automatic client-side
481 throttling. This is a provisional mode whose behavior might change.
482
483 ``sigv4a_signing_region_set``
484 A comma-delimited list of regions use when signing with SigV4a. If this is not set,
485 the SDK will check if the service has modeled a default; if none is found, this will
486 default to ``*``.
487
488 ``request_checksum_calculation``
489 Determines when a checksum will be calculated for request payloads. Valid values are:
490
491 * ``when_supported`` -- When set, a checksum will be calculated for
492 all request payloads of operations modeled with the ``httpChecksum``
493 trait where ``requestChecksumRequired`` is ``true`` or a
494 ``requestAlgorithmMember`` is modeled.
495
496 * ``when_required`` -- When set, a checksum will only be calculated
497 for request payloads of operations modeled with the ``httpChecksum``
498 trait where ``requestChecksumRequired`` is ``true`` or where a
499 ``requestAlgorithmMember`` is modeled and supplied.
500
501 ``response_checksum_validation``
502 Determines when checksum validation will be performed on response payloads. Valid values are:
503
504 * ``when_supported`` -- When set, checksum validation is performed on
505 all response payloads of operations modeled with the ``httpChecksum``
506 trait where ``responseAlgorithms`` is modeled, except when no modeled
507 checksum algorithms are supported.
508
509 * ``when_required`` -- When set, checksum validation is not performed
510 on response payloads of operations unless the checksum algorithm is
511 supported and the ``requestValidationModeMember`` member is set to ``ENABLED``.
512
513 ``use_dualstack_endpoint``
514 When ``true``, dualstack endpoint resolution is enabled. Valid values are ``true`` or ``false``. Default : ``false``.
515
516 .. _IAM Roles for Amazon EC2: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-roles-for-amazon-ec2.html
517 .. _Using IAM Roles: http://docs.aws.amazon.com/IAM/latest/UserGuide/id_roles_use.html
518 .. _Sourcing Credentials with an External Process: https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-sourcing-external.html
519
520
521 Using Account ID-Based Endpoints
522 --------------------------------
523 Boto3 supports account ID-based endpoints, which improve performance and scalability by using your AWS account ID to streamline request routing for services that support this feature. When Boto3 resolves credentials containing an account ID, it automatically constructs an account ID-based endpoint instead of a regional endpoint.
524
525 Account ID-based endpoints follow this format:
526
527 .. code-block:: shell
528
529 https://<account-id>.myservice.<region>.amazonaws.com
530
531
532 * ``<account-id>`` is the AWS account ID sourced from your credentials.
533 * ``<region>`` is the AWS region where the request is being made.
534
535
536 Supported Credential Providers
537 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
538
539 Boto3 can automatically construct account ID-based endpoints by sourcing the AWS account ID from the following places:
540
541 * Credentials set using the ``boto3.client()`` method
542 * Credentials set when creating a ``Session`` object
543 * Environment variables
544 * Assume role provider
545 * Assume role with web identity provider
546 * AWS IAM Identity Center credential provider
547 * Shared credential file (``~/.aws/credentials``)
548 * AWS config file (``~/.aws/config``)
549 * Container credential provider
550
551 You can read more about these locations in the :ref:`guide_credentials` guide.
552
553
554 Configuring Account ID
555 ~~~~~~~~~~~~~~~~~~~~~~
556
557 You can provide an account ID along with your AWS credentials using one of the following:
558
559 Passing it as a parameter when creating clients:
560
561 .. code-block:: python
562
563 import boto3
564
565 client = boto3.client(
566 'dynamodb',
567 aws_access_key_id=ACCESS_KEY,
568 aws_secret_access_key=SECRET_KEY,
569 aws_account_id=ACCOUNT_ID
570 )
571
572 Passing it as a parameter when creating a ``Session`` object:
573
574 .. code-block:: python
575
576 import boto3
577
578 session = boto3.Session(
579 aws_access_key_id=ACCESS_KEY,
580 aws_secret_access_key=SECRET_KEY,
581 aws_account_id=ACCOUNT_ID
582 )
583
584 Setting an environment variable:
585
586 .. code-block:: shell
587
588 export AWS_ACCESS_KEY_ID=<ACCESS_KEY>
589 export AWS_SECRET_ACCESS_KEY=<SECRET_KEY>
590 export AWS_ACCOUNT_ID=<ACCOUNT_ID>
591
592 Setting it in the shared credentials or config file:
593
594 .. code-block:: ini
595
596 [default]
597 aws_access_key_id=foo
598 aws_secret_access_key=bar
599 aws_account_id=baz
600
601
602 Configuring Endpoint Routing Behavior
603 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
604
605 The account ID endpoint mode is a setting that can be used to turn off account ID-based endpoint routing if necessary.
606
607 Valid values are:
608
609 * ``preferred`` – The endpoint should include account ID if available.
610 * ``disabled`` – A resolved endpoint doesn't include account ID.
611 * ``required`` – The endpoint must include account ID. If the account ID isn't available, the SDK throws an error.
612
613 .. note::
614
615 The default behavior in Boto3 is ``preferred``.
616
617
618 You can configure the setting using one of the following:
619
620 Setting it in the ``Config`` object when creating clients:
621
622 .. code-block:: python
623
624 import boto3
625 from botocore.config import Config
626
627 my_config = Config(
628 account_id_endpoint_mode = 'disabled'
629 )
630
631 client = boto3.client('dynamodb', config=my_config)
632
633 Setting an environment variable:
634
635 .. code-block:: shell
636
637 export AWS_ACCOUNT_ID_ENDPOINT_MODE=disabled
638
639 Setting it in the shared credentials or config file:
640
641 .. code-block:: ini
642
643 [default]
644 account_id_endpoint_mode=disabled