# CpuCredits

Provides the options for specifying the CPU credit type for burstable EC2 instance types (T2, T3, T3a, etc).

- Source: [`aws-ec2/lib/launch-template.ts`](https://github.com/aws/aws-cdk/blob/v2.278.0/packages/aws-cdk-lib/aws-ec2/lib/launch-template.ts#L47)

## Example

TypeScript:

```ts
declare const vpc: ec2.Vpc;

const instance = new ec2.Instance(this, 'Instance', {
  instanceType: ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),
  machineImage: ec2.MachineImage.latestAmazonLinux2(),
  vpc: vpc,
  creditSpecification: ec2.CpuCredits.STANDARD,
});
```

Python:

```python
# vpc: ec2.Vpc

instance = ec2.Instance(self, "Instance",
    instance_type=ec2.InstanceType.of(ec2.InstanceClass.T3, ec2.InstanceSize.MICRO),
    machine_image=ec2.MachineImage.latest_amazon_linux2(),
    vpc=vpc,
    credit_specification=ec2.CpuCredits.STANDARD
)
```

Java:

```java
Vpc vpc;

Instance instance = Instance.Builder.create(this, "Instance")
        .instanceType(InstanceType.of(InstanceClass.T3, InstanceSize.MICRO))
        .machineImage(MachineImage.latestAmazonLinux2())
        .vpc(vpc)
        .creditSpecification(CpuCredits.STANDARD)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
Vpc vpc;

var instance = new Instance(this, "Instance", new InstanceProps {
    InstanceType = InstanceType.Of(InstanceClass.T3, InstanceSize.MICRO),
    MachineImage = MachineImage.LatestAmazonLinux2(),
    Vpc = vpc,
    CreditSpecification = CpuCredits.STANDARD
});
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var vpc Vpc

instance := ec2.NewInstance(this, jsii.String("Instance"), &InstanceProps{
	InstanceType: ec2.InstanceType_Of(ec2.InstanceClass_T3, ec2.InstanceSize_MICRO),
	MachineImage: ec2.MachineImage_LatestAmazonLinux2(),
	Vpc: vpc,
	CreditSpecification: ec2.CpuCredits_STANDARD,
})
```

## Members

| Member | Description |
| --- | --- |
| `STANDARD` | Standard bursting mode. |
| `UNLIMITED` | Unlimited bursting mode. |

## Referenced by

- [`InstanceProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.InstanceProps.html).creditSpecification
- [`LaunchTemplateProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.LaunchTemplateProps.html).cpuCredits
- [`NatInstanceProps`](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ec2.NatInstanceProps.html).creditSpecification
