Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions,
see Getting Started with Amazon Web Services in China
(PDF).
Use ModifyInstanceCreditSpecification
with a CLI
The following code examples show how to use ModifyInstanceCreditSpecification
.
- CLI
-
- Amazon CLI
-
To modify the credit option for CPU usage of an instance
This example modifies the credit option for CPU usage of the specified instance in the specified region to "unlimited". Valid credit options are "standard" and "unlimited".
Command:
aws ec2 modify-instance-credit-specification --instance-credit-specification "InstanceId=i-1234567890abcdef0,CpuCredits=unlimited"
Output:
{
"SuccessfulInstanceCreditSpecifications": [
{
"InstanceId": "i-1234567890abcdef0"
}
],
"UnsuccessfulInstanceCreditSpecifications": []
}
- PowerShell
-
- Tools for PowerShell
-
Example 1: This enables T2 unlimited credits for instance i-01234567890abcdef.
$Credit = New-Object -TypeName Amazon.EC2.Model.InstanceCreditSpecificationRequest
$Credit.InstanceId = "i-01234567890abcdef"
$Credit.CpuCredits = "unlimited"
Edit-EC2InstanceCreditSpecification -InstanceCreditSpecification $Credit
For a complete list of Amazon SDK developer guides and code examples, see
Create Amazon EC2 resources using an Amazon SDK.
This topic also includes information about getting started and details about previous SDK versions.