- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
ModifyInstanceCreditSpecificationCommand
Modifies the credit option for CPU usage on a running or stopped burstable performance instance. The credit options are standard
and unlimited
.
For more information, see Burstable performance instances in the Amazon EC2 User Guide.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { EC2Client, ModifyInstanceCreditSpecificationCommand } from "@aws-sdk/client-ec2"; // ES Modules import
// const { EC2Client, ModifyInstanceCreditSpecificationCommand } = require("@aws-sdk/client-ec2"); // CommonJS import
const client = new EC2Client(config);
const input = { // ModifyInstanceCreditSpecificationRequest
DryRun: true || false,
ClientToken: "STRING_VALUE",
InstanceCreditSpecifications: [ // InstanceCreditSpecificationListRequest // required
{ // InstanceCreditSpecificationRequest
InstanceId: "STRING_VALUE", // required
CpuCredits: "STRING_VALUE",
},
],
};
const command = new ModifyInstanceCreditSpecificationCommand(input);
const response = await client.send(command);
// { // ModifyInstanceCreditSpecificationResult
// SuccessfulInstanceCreditSpecifications: [ // SuccessfulInstanceCreditSpecificationSet
// { // SuccessfulInstanceCreditSpecificationItem
// InstanceId: "STRING_VALUE",
// },
// ],
// UnsuccessfulInstanceCreditSpecifications: [ // UnsuccessfulInstanceCreditSpecificationSet
// { // UnsuccessfulInstanceCreditSpecificationItem
// InstanceId: "STRING_VALUE",
// Error: { // UnsuccessfulInstanceCreditSpecificationItemError
// Code: "InvalidInstanceID.Malformed" || "InvalidInstanceID.NotFound" || "IncorrectInstanceState" || "InstanceCreditSpecification.NotSupported",
// Message: "STRING_VALUE",
// },
// },
// ],
// };
ModifyInstanceCreditSpecificationCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
InstanceCreditSpecifications Required | InstanceCreditSpecificationRequest[] | undefined | Information about the credit option for CPU usage. |
ClientToken | string | undefined | A unique, case-sensitive token that you provide to ensure idempotency of your modification request. For more information, see Ensuring Idempotency . |
DryRun | boolean | undefined | Checks whether you have the required permissions for the operation, without actually making the request, and provides an error response. If you have the required permissions, the error response is |
ModifyInstanceCreditSpecificationCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
SuccessfulInstanceCreditSpecifications | SuccessfulInstanceCreditSpecificationItem[] | undefined | Information about the instances whose credit option for CPU usage was successfully modified. |
UnsuccessfulInstanceCreditSpecifications | UnsuccessfulInstanceCreditSpecificationItem[] | undefined | Information about the instances whose credit option for CPU usage was not modified. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
EC2ServiceException | Base exception class for all service exceptions from EC2 service. |