# CfnInstanceProps

Properties for defining a `CfnInstance`.

Extends: CfnInstanceProps
Used as props by: CfnInstance

- Source: Generated code
- Type last changed: v2.55.0 · 14 Dec 2022

## Example

```ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_lightsail as lightsail } from 'aws-cdk-lib';
const cfnInstanceProps: lightsail.CfnInstanceProps = {
  blueprintId: 'blueprintId',
  bundleId: 'bundleId',
  instanceName: 'instanceName',

  // the properties below are optional
  addOns: [{
    addOnType: 'addOnType',

    // the properties below are optional
    autoSnapshotAddOnRequest: {
      snapshotTimeOfDay: 'snapshotTimeOfDay',
    },
    status: 'status',
  }],
  availabilityZone: 'availabilityZone',
  hardware: {
    cpuCount: 123,
    disks: [{
      diskName: 'diskName',
      path: 'path',

      // the properties below are optional
      attachedTo: 'attachedTo',
      attachmentState: 'attachmentState',
      iops: 123,
      isSystemDisk: false,
      sizeInGb: 'sizeInGb',
    }],
    ramSizeInGb: 123,
  },
  keyPairName: 'keyPairName',
  location: {
    availabilityZone: 'availabilityZone',
    regionName: 'regionName',
  },
  networking: {
    ports: [{
      accessDirection: 'accessDirection',
      accessFrom: 'accessFrom',
      accessType: 'accessType',
      cidrListAliases: ['cidrListAliases'],
      cidrs: ['cidrs'],
      commonName: 'commonName',
      fromPort: 123,
      ipv6Cidrs: ['ipv6Cidrs'],
      protocol: 'protocol',
      toPort: 123,
    }],

    // the properties below are optional
    monthlyTransfer: {
      gbPerMonthAllocated: 'gbPerMonthAllocated',
    },
  },
  state: {
    code: 123,
    name: 'name',
  },
  tags: [{
    key: 'key',
    value: 'value',
  }],
  userData: 'userData',
};
```

## Properties

- `addOns`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnInstance.AddOnProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnInstance.AddOnProperty.html)[] — An array of add-ons for the instance.

  > If the instance has an add-on enabled when performing a delete instance request, the add-on is automatically disabled before the instance is deleted.

- `availabilityZone`: string — The Availability Zone for the instance.

- `blueprintId`: string (required) — The blueprint ID for the instance (for example, `os_amlinux_2016_03` ).

- `bundleId`: string (required) — The bundle ID for the instance (for example, `micro_1_0` ).

- `hardware`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnInstance.HardwareProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnInstance.HardwareProperty.html) — The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.

  > The instance restarts when performing an attach disk or detach disk request. This resets the public IP address of your instance if a static IP isn't attached to it.

- `instanceName`: string (required) — The name of the instance.

- `keyPairName`: string — The name of the key pair to use for the instance.

  If no key pair name is specified, the Regional Lightsail default key pair is used.

- `location`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnInstance.LocationProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnInstance.LocationProperty.html) — The location for the instance, such as the AWS Region and Availability Zone.

  > The `Location` property is read-only and should not be specified in a create instance or update instance request.

- `networking`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnInstance.NetworkingProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnInstance.NetworkingProperty.html) — The public ports and the monthly amount of data transfer allocated for the instance.

- `state`: [IResolvable](/cdk/api/v2/docs/aws-cdk-lib.IResolvable.html) | [CfnInstance.StateProperty](/cdk/api/v2/docs/aws-cdk-lib.aws_lightsail.CfnInstance.StateProperty.html) — The status code and the state (for example, `running` ) of the instance.

  > The `State` property is read-only and should not be specified in a create instance or update instance request.

- `tags`: [CfnTag](/cdk/api/v2/docs/aws-cdk-lib.CfnTag.html)[] — An array of key-value pairs to apply to this resource.

  For more information, see [Tag](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-resource-tags.html) in the *AWS CloudFormation User Guide* .

  > The `Value` of `Tags` is optional for Lightsail resources.

- `userData`: string — The optional launch script for the instance.

  Specify a launch script to configure an instance with additional user data. For example, you might want to specify `apt-get -y update` as a launch script.

  > Depending on the blueprint of your instance, the command to get software on your instance varies. Amazon Linux and CentOS use `yum` , Debian and Ubuntu use `apt-get` , and FreeBSD uses `pkg` .
