# StateProperty

Describes the current state of an instance.

- Source: Generated at build time
- Type last changed: v2.141.0 · 8 May 2024

## Example

TypeScript:

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_ec2 as ec2 } from 'aws-cdk-lib';
const stateProperty: ec2.CfnInstance.StateProperty = {
  code: 'code',
  name: 'name',
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_ec2 as ec2

state_property = ec2.CfnInstance.StateProperty(
    code="code",
    name="name"
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.ec2.*;

StateProperty stateProperty = StateProperty.builder()
        .code("code")
        .name("name")
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.EC2;

var stateProperty = new StateProperty {
    Code = "code",
    Name = "name"
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"

stateProperty := &StateProperty{
	Code: jsii.String("code"),
	Name: jsii.String("name"),
}
```

## Properties

- `code`: string — The state of the instance as a 16-bit unsigned integer.

  The high byte is all of the bits between 2^8 and (2^16)-1, which equals decimal values between 256 and 65,535. These numerical values are used for internal purposes and should be ignored.

  The low byte is all of the bits between 2^0 and (2^8)-1, which equals decimal values between 0 and 255.

  The valid values for instance-state-code will all be in the range of the low byte and they are:

  - `0` : `pending`
  - `16` : `running`
  - `32` : `shutting-down`
  - `48` : `terminated`
  - `64` : `stopping`
  - `80` : `stopped`

  You can ignore the high byte value by zeroing out all of the bits above 2^8 or 256 in decimal.

- `name`: string — The current state of the instance.
