Skip to main content

instances

Creates, updates, deletes or gets an instance resource or lists instances in a region

Overview

Nameinstances
TypeResource
DescriptionResource Type definition for AWS::Lightsail::Instance
Idawscc.lightsail.instances

Fields

NameDatatypeDescription
support_codestringSupport code to help identify any issues
resource_typestringResource type of Lightsail instance.
is_static_ipbooleanIs the IP Address of the Instance is the static IP
private_ip_addressstringPrivate IP Address of the Instance
public_ip_addressstringPublic IP Address of the Instance
ipv6_addressesarrayIPv6 addresses of the instance
locationobjectThe region name and Availability Zone where you created the snapshot.
hardwareobjectHardware of the Instance.
stateobjectCurrent State of the Instance.
networkingobjectNetworking of the Instance.
user_namestringUsername of the Lightsail instance.
ssh_key_namestringSSH Key Name of the Lightsail instance.
instance_namestringThe names to use for your new Lightsail instance.
availability_zonestringThe Availability Zone in which to create your instance. Use the following format: us-east-2a (case sensitive). Be sure to add the include Availability Zones parameter to your request.
bundle_idstringThe bundle of specification information for your virtual private server (or instance ), including the pricing plan (e.g., micro_1_0 ).
blueprint_idstringThe ID for a virtual private server image (e.g., app_wordpress_4_4 or app_lamp_7_0 ). Use the get blueprints operation to return a list of available images (or blueprints ).
add_onsarrayAn array of objects representing the add-ons to enable for the new instance.
user_datastringA launch script you can create that configures a server with additional user data. For example, you might want to run apt-get -y update.
key_pair_namestringThe name of your key pair.
tagsarrayAn array of key-value pairs to apply to this resource.
instance_arnstring
regionstringAWS region.

For more information, see AWS::Lightsail::Instance.

Methods

NameResourceAccessible byRequired Params
create_resourceinstancesINSERTInstanceName, BlueprintId, BundleId, region
delete_resourceinstancesDELETEIdentifier, region
update_resourceinstancesUPDATEIdentifier, PatchDocument, region
list_resourcesinstances_list_onlySELECTregion
get_resourceinstancesSELECTIdentifier, region

SELECT examples

Gets all properties from an individual instance.

SELECT
region,
support_code,
resource_type,
is_static_ip,
private_ip_address,
public_ip_address,
ipv6_addresses,
location,
hardware,
state,
networking,
user_name,
ssh_key_name,
instance_name,
availability_zone,
bundle_id,
blueprint_id,
add_ons,
user_data,
key_pair_name,
tags,
instance_arn
FROM awscc.lightsail.instances
WHERE
region = '{{ region }}' AND
Identifier = '{{ instance_name }}';

INSERT example

Use the following StackQL query and manifest file to create a new instance resource, using stack-deploy.

/*+ create */
INSERT INTO awscc.lightsail.instances (
InstanceName,
BundleId,
BlueprintId,
region
)
SELECT
'{{ instance_name }}',
'{{ bundle_id }}',
'{{ blueprint_id }}',
'{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

UPDATE example

Use the following StackQL query and manifest file to update a instance resource, using stack-deploy.

/*+ update */
UPDATE awscc.lightsail.instances
SET PatchDocument = string('{{ {
"AddOns": add_ons,
"UserData": user_data,
"KeyPairName": key_pair_name,
"Tags": tags
} | generate_patch_document }}')
WHERE
region = '{{ region }}' AND
Identifier = '{{ instance_name }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

DELETE example

/*+ delete */
DELETE FROM awscc.lightsail.instances
WHERE
Identifier = '{{ instance_name }}' AND
region = '{{ region }}'
RETURNING
ErrorCode,
EventTime,
Identifier,
Operation,
OperationStatus,
RequestToken,
ResourceModel,
RetryAfter,
StatusMessage,
TypeName
;

Additional Parameters

Mutable resources in the Cloud Control provider support additional optional parameters which can be supplied with INSERT, UPDATE, or DELETE operations. These include:

ParameterDescription
ClientToken
A unique identifier to ensure the idempotency of the resource request.This allows the provider to accurately distinguish between retries and new requests.
A client token is valid for 36 hours once used.
After that, a resource request with the same client token is treated as a new request.
If you do not specify a client token, one is generated for inclusion in the request.
RoleArn
The ARN of the IAM role used to perform this resource operation.The role specified must have the permissions required for this operation.
If you do not specify a role, a temporary session is created using your AWS user credentials.
TypeVersionId
For private resource types, the type version to use in this resource operation.If you do not specify a resource version, the default version is used.

Permissions

To operate on the instances resource, the following permissions are required:

lightsail:CreateInstances,
lightsail:GetInstances,
lightsail:EnableAddOn,
lightsail:GetInstance,
lightsail:DisableAddOn,
lightsail:PutInstancePublicPorts,
lightsail:AttachDisk,
lightsail:DetachDisk,
lightsail:StartInstance,
lightsail:StopInstance,
lightsail:GetDisk,
lightsail:GetRegions,
lightsail:TagResource,
lightsail:UntagResource