Jump to Content

This API Documentation is now deprecated

We are excited to announce our new API Documentation.

Class DeleteAccessKeyCommandProtected

Deletes the access key pair associated with the specified IAM user.

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 even if the Amazon Web Services account has no associated users.

Example

Use a bare-bones client and the command you need to make an API call.

import { IAMClient, DeleteAccessKeyCommand } from "@aws-sdk/client-iam"; // ES Modules import
// const { IAMClient, DeleteAccessKeyCommand } = require("@aws-sdk/client-iam"); // CommonJS import
const client = new IAMClient(config);
const input = { // DeleteAccessKeyRequest
UserName: "STRING_VALUE",
AccessKeyId: "STRING_VALUE", // required
};
const command = new DeleteAccessKeyCommand(input);
const response = await client.send(command);
// {};

Param

DeleteAccessKeyCommandInput

Returns

DeleteAccessKeyCommandOutput

See

Throws

LimitExceededException (client fault)

The request was rejected because it attempted to create resources beyond the current Amazon Web Services account limits. The error message describes the limit exceeded.

Throws

NoSuchEntityException (client fault)

The request was rejected because it referenced a resource entity that does not exist. The error message describes the resource.

Throws

ServiceFailureException (server fault)

The request processing has failed because of an unknown error, exception or failure.

Throws

IAMServiceException

Base exception class for all service exceptions from IAM service.

Example

To delete an access key for an IAM user

// The following command deletes one access key (access key ID and secret access key) assigned to the IAM user named Bob.
const input = {
"AccessKeyId": "AKIDPMS9RO4H3FEXAMPLE",
"UserName": "Bob"
};
const command = new DeleteAccessKeyCommand(input);
await client.send(command);
// example id: 61a785a7-d30a-415a-ae18-ab9236e56871

Hierarchy

Constructors

Properties

Methods

Constructors

Properties

Methods