instances
Creates, updates, deletes or gets an instance resource or lists instances in a region
Overview
| Name | instances |
| Type | Resource |
| Description | Resource Type definition for AWS::Lightsail::Instance |
| Id | awscc.lightsail.instances |
Fields
- get (all properties)
- list (identifiers only)
| Name | Datatype | Description |
|---|---|---|
support_code | string | Support code to help identify any issues |
resource_type | string | Resource type of Lightsail instance. |
is_static_ip | boolean | Is the IP Address of the Instance is the static IP |
private_ip_address | string | Private IP Address of the Instance |
public_ip_address | string | Public IP Address of the Instance |
ipv6_addresses | array | IPv6 addresses of the instance |
location | object | The region name and Availability Zone where you created the snapshot. |
hardware | object | Hardware of the Instance. |
state | object | Current State of the Instance. |
networking | object | Networking of the Instance. |
user_name | string | Username of the Lightsail instance. |
ssh_key_name | string | SSH Key Name of the Lightsail instance. |
instance_name | string | The names to use for your new Lightsail instance. |
availability_zone | string | The 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_id | string | The bundle of specification information for your virtual private server (or instance ), including the pricing plan (e.g., micro_1_0 ). |
blueprint_id | string | The 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_ons | array | An array of objects representing the add-ons to enable for the new instance. |
user_data | string | A 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_name | string | The name of your key pair. |
tags | array | An array of key-value pairs to apply to this resource. |
instance_arn | string | |
region | string | AWS region. |
| Name | Datatype | Description |
|---|---|---|
instance_name | string | The names to use for your new Lightsail instance. |
region | string | AWS region. |
For more information, see AWS::Lightsail::Instance.
Methods
| Name | Resource | Accessible by | Required Params |
|---|---|---|---|
create_resource | instances | INSERT | InstanceName, BlueprintId, BundleId, region |
delete_resource | instances | DELETE | Identifier, region |
update_resource | instances | UPDATE | Identifier, PatchDocument, region |
list_resources | instances_list_only | SELECT | region |
get_resource | instances | SELECT | Identifier, region |
SELECT examples
- get (all properties)
- list (identifiers only)
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 = 'us-east-1' AND
Identifier = '{{ instance_name }}';
Lists all instances in a region.
SELECT
region,
instance_name
FROM awscc.lightsail.instances_list_only
WHERE
region = 'us-east-1';
INSERT example
Use the following StackQL query and manifest file to create a new instance resource, using stack-deploy.
- Required Properties
- All Properties
- Manifest
/*+ create */
INSERT INTO awscc.lightsail.instances (
InstanceName,
BundleId,
BlueprintId,
region
)
SELECT
'{{ instance_name }}',
'{{ bundle_id }}',
'{{ blueprint_id }}',
'{{ region }}';
/*+ create */
INSERT INTO awscc.lightsail.instances (
Location,
Hardware,
State,
Networking,
InstanceName,
AvailabilityZone,
BundleId,
BlueprintId,
AddOns,
UserData,
KeyPairName,
Tags,
region
)
SELECT
'{{ location }}',
'{{ hardware }}',
'{{ state }}',
'{{ networking }}',
'{{ instance_name }}',
'{{ availability_zone }}',
'{{ bundle_id }}',
'{{ blueprint_id }}',
'{{ add_ons }}',
'{{ user_data }}',
'{{ key_pair_name }}',
'{{ tags }}',
'{{ region }}';
version: 1
name: stack name
description: stack description
providers:
- aws
globals:
- name: region
value: '{{ vars.AWS_REGION }}'
resources:
- name: instance
props:
- name: location
value:
availability_zone: '{{ availability_zone }}'
region_name: '{{ region_name }}'
- name: hardware
value:
cpu_count: '{{ cpu_count }}'
ram_size_in_gb: '{{ ram_size_in_gb }}'
disks:
- disk_name: '{{ disk_name }}'
size_in_gb: '{{ size_in_gb }}'
is_system_disk: '{{ is_system_disk }}'
i_op_s: '{{ i_op_s }}'
path: '{{ path }}'
attached_to: '{{ attached_to }}'
attachment_state: '{{ attachment_state }}'
- name: state
value:
code: '{{ code }}'
name: '{{ name }}'
- name: networking
value:
ports:
- from_port: '{{ from_port }}'
to_port: '{{ to_port }}'
protocol: '{{ protocol }}'
access_from: '{{ access_from }}'
access_type: '{{ access_type }}'
common_name: '{{ common_name }}'
access_direction: '{{ access_direction }}'
ipv6_cidrs:
- '{{ ipv6_cidrs[0] }}'
cidr_list_aliases:
- '{{ cidr_list_aliases[0] }}'
cidrs:
- '{{ cidrs[0] }}'
monthly_transfer:
gb_per_month_allocated: '{{ gb_per_month_allocated }}'
- name: instance_name
value: '{{ instance_name }}'
- name: availability_zone
value: '{{ availability_zone }}'
- name: bundle_id
value: '{{ bundle_id }}'
- name: blueprint_id
value: '{{ blueprint_id }}'
- name: add_ons
value:
- add_on_type: '{{ add_on_type }}'
status: '{{ status }}'
auto_snapshot_add_on_request:
snapshot_time_of_day: '{{ snapshot_time_of_day }}'
- name: user_data
value: '{{ user_data }}'
- name: key_pair_name
value: '{{ key_pair_name }}'
- name: tags
value:
- key: '{{ key }}'
value: '{{ value }}'
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 }}';
DELETE example
/*+ delete */
DELETE FROM awscc.lightsail.instances
WHERE
Identifier = '{{ instance_name }}' AND
region = 'us-east-1';
Permissions
To operate on the instances resource, the following permissions are required:
- Create
- Read
- Delete
- List
- Update
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
lightsail:GetInstances,
lightsail:GetInstance
lightsail:GetInstances,
lightsail:GetInstance,
lightsail:DeleteInstance
lightsail:GetInstances
lightsail:GetInstances,
lightsail:GetInstance,
lightsail:DeleteInstance,
lightsail:EnableAddOn,
lightsail:DisableAddOn,
lightsail:PutInstancePublicPorts,
lightsail:AttachDisk,
lightsail:DetachDisk,
lightsail:StartInstance,
lightsail:StopInstance,
lightsail:GetDisk,
lightsail:TagResource,
lightsail:UntagResource