Skip to content

create_access_key

Operation

create_access_key

create_access_key(request: CreateAccessKeyInput | CreateAccessKeyInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreateAccessKeyInputDict]) -> CreateAccessKeyOutput

Creates a new Amazon Web Services secret access key and corresponding Amazon Web Services access key ID for the specified user. The default status for new keys is Active.

If you do not specify a user name, IAM determines the user name implicitly based on the Amazon Web Services access key ID signing the request. This operation works for access keys under the Amazon Web Services account. Consequently, you can use this operation to manage Amazon Web Services account root user credentials. This is true even if the Amazon Web Services account has no associated users.

For information about quotas on the number of keys you can create, see IAM and STS quotas in the IAM User Guide.

Warning

To ensure the security of your Amazon Web Services account, the secret access key is accessible only during key and user creation. You must save the key (for example, in a text file) if you want to be able to access it again. If a secret key is lost, you can delete the access keys for the associated user and then create new keys.

Parameters:

Name Type Description Default
request CreateAccessKeyInput | CreateAccessKeyInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None
**kwargs Unpack[CreateAccessKeyInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreateAccessKeyOutput

An instance of CreateAccessKeyOutput.

create_access_key async

create_access_key(request: CreateAccessKeyInput | CreateAccessKeyInputDict | None = None, /, *, plugins: list[Plugin] | None = None, **kwargs: Unpack[CreateAccessKeyInputDict]) -> CreateAccessKeyOutput

Creates a new Amazon Web Services secret access key and corresponding Amazon Web Services access key ID for the specified user. The default status for new keys is Active.

If you do not specify a user name, IAM determines the user name implicitly based on the Amazon Web Services access key ID signing the request. This operation works for access keys under the Amazon Web Services account. Consequently, you can use this operation to manage Amazon Web Services account root user credentials. This is true even if the Amazon Web Services account has no associated users.

For information about quotas on the number of keys you can create, see IAM and STS quotas in the IAM User Guide.

Warning

To ensure the security of your Amazon Web Services account, the secret access key is accessible only during key and user creation. You must save the key (for example, in a text file) if you want to be able to access it again. If a secret key is lost, you can delete the access keys for the associated user and then create new keys.

Parameters:

Name Type Description Default
request CreateAccessKeyInput | CreateAccessKeyInputDict | None

The input as a model or dictionary. Pass this or keyword arguments, not both.

None
plugins list[Plugin] | None

A list of callables that modify the configuration dynamically. Changes made by these plugins only apply for the duration of the operation execution and will not affect any other operation invocations.

None
**kwargs Unpack[CreateAccessKeyInputDict]

The input fields as keyword arguments.

{}

Returns:

Type Description
CreateAccessKeyOutput

An instance of CreateAccessKeyOutput.

Input

Pass the input as keyword arguments, a positional dictionary, or a positional model object. Pass plugins separately as a keyword argument.

CreateAccessKeyInputDict

Bases: TypedDict

Dictionary form of CreateAccessKeyInput.

Attributes

user_name instance-attribute
user_name: str | None

The name of the IAM user that the new key will belong to.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

CreateAccessKeyInput dataclass

Bases: _SerdeShape

Dataclass for CreateAccessKeyInput structure.

Attributes

user_name class-attribute instance-attribute
user_name: str | None = ...

The name of the IAM user that the new key will belong to.

This parameter allows (through its regex pattern) a string of characters consisting of upper and lowercase alphanumeric characters with no spaces. You can also include any of the following characters: _+=,.@-

Output

CreateAccessKeyOutput dataclass

Bases: _SerdeShape

Contains the response to a successful CreateAccessKey request.

Attributes

access_key instance-attribute
access_key: AccessKey

A structure with details about the access key.

response_metadata class-attribute instance-attribute
response_metadata: ResponseMetadata = ...

Metadata about the response that produced this output. Use this to recover the request identifiers a service's support team needs in order to investigate a call. Members of the metadata are individually optional.