AWS Fundamentals Logo
AWS Fundamentals
L1 ConstructAWS::Lightsail::Instance

CfnInstance

The `AWS::Lightsail::Instance` resource specifies an Amazon Lightsail instance.

Import

import { CfnInstance } from 'aws-cdk-lib/aws-lightsail';

Or use the module namespace:

import * as lightsail from 'aws-cdk-lib/aws-lightsail';
// lightsail.CfnInstance

Properties

Configuration passed to the constructor as CfnInstanceProps.

blueprintIdRequired
string

The blueprint ID for the instance (for example, `os_amlinux_2016_03` ).

bundleIdRequired
string

The bundle ID for the instance (for example, `micro_1_0` ).

instanceNameRequired
string

The name of the instance.

addOnsOptional
IResolvable | IResolvable | AddOnProperty[]

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.

availabilityZoneOptional
string

The Availability Zone for the instance.

hardwareOptional
IResolvable | HardwareProperty

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.

keyPairNameOptional
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.

locationOptional
IResolvable | LocationProperty

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.

networkingOptional
IResolvable | NetworkingProperty

The public ports and the monthly amount of data transfer allocated for the instance.

stateOptional
IResolvable | StateProperty

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.

tagsOptional
CfnTag[]

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.

userDataOptional
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` .

CloudFormation Resource

This L1 construct maps directly to the following CloudFormation resource type.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter