CfnInstance

class aws_cdk.aws_lightsail.CfnInstance(scope, id, *, blueprint_id, bundle_id, instance_name, add_ons=None, availability_zone=None, hardware=None, key_pair_name=None, networking=None, tags=None, user_data=None)

Bases: aws_cdk.core.CfnResource

A CloudFormation AWS::Lightsail::Instance.

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

CloudformationResource

AWS::Lightsail::Instance

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_lightsail as lightsail

cfn_instance = lightsail.CfnInstance(self, "MyCfnInstance",
    blueprint_id="blueprintId",
    bundle_id="bundleId",
    instance_name="instanceName",

    # the properties below are optional
    add_ons=[lightsail.CfnInstance.AddOnProperty(
        add_on_type="addOnType",

        # the properties below are optional
        auto_snapshot_add_on_request=lightsail.CfnInstance.AutoSnapshotAddOnProperty(
            snapshot_time_of_day="snapshotTimeOfDay"
        ),
        status="status"
    )],
    availability_zone="availabilityZone",
    hardware=lightsail.CfnInstance.HardwareProperty(
        cpu_count=123,
        disks=[lightsail.CfnInstance.DiskProperty(
            disk_name="diskName",
            path="path",

            # the properties below are optional
            attached_to="attachedTo",
            attachment_state="attachmentState",
            iops=123,
            is_system_disk=False,
            size_in_gb="sizeInGb"
        )],
        ram_size_in_gb=123
    ),
    key_pair_name="keyPairName",
    networking=lightsail.CfnInstance.NetworkingProperty(
        ports=[lightsail.CfnInstance.PortProperty(
            access_direction="accessDirection",
            access_from="accessFrom",
            access_type="accessType",
            cidr_list_aliases=["cidrListAliases"],
            cidrs=["cidrs"],
            common_name="commonName",
            from_port=123,
            ipv6_cidrs=["ipv6Cidrs"],
            protocol="protocol",
            to_port=123
        )],

        # the properties below are optional
        monthly_transfer=123
    ),
    tags=[CfnTag(
        key="key",
        value="value"
    )],
    user_data="userData"
)

Create a new AWS::Lightsail::Instance.

Parameters
  • scope (Construct) –

    • scope in which this resource is defined.

  • id (str) –

    • scoped id of the resource.

  • blueprint_id (str) – The blueprint ID for the instance (for example, os_amlinux_2016_03 ).

  • bundle_id (str) – The bundle ID for the instance (for example, micro_1_0 ).

  • instance_name (str) – The name of the instance.

  • add_ons (Union[IResolvable, Sequence[Union[IResolvable, AddOnProperty]], None]) – An array of add-ons for the instance. .. epigraph:: 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.

  • availability_zone (Optional[str]) – The Availability Zone for the instance.

  • hardware (Union[IResolvable, HardwareProperty, None]) – The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM. .. epigraph:: 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.

  • key_pair_name (Optional[str]) – 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.

  • networking (Union[IResolvable, NetworkingProperty, None]) – The public ports and the monthly amount of data transfer allocated for the instance.

  • tags (Optional[Sequence[CfnTag]]) – An array of key-value pairs to apply to this resource. For more information, see Tag in the AWS CloudFormation User Guide . .. epigraph:: The Value of Tags is optional for Lightsail resources.

  • user_data (Optional[str]) – 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. .. epigraph:: 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 .

Methods

add_deletion_override(path)

Syntactic sugar for addOverride(path, undefined).

Parameters

path (str) – The path of the value to delete.

Return type

None

add_depends_on(target)

Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.

This can be used for resources across stacks (or nested stack) boundaries and the dependency will automatically be transferred to the relevant scope.

Parameters

target (CfnResource) –

Return type

None

add_metadata(key, value)

Add a value to the CloudFormation Resource Metadata.

Parameters
  • key (str) –

  • value (Any) –

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

Return type

None

add_override(path, value)

Adds an override to the synthesized CloudFormation resource.

To add a property override, either use addPropertyOverride or prefix path with “Properties.” (i.e. Properties.TopicName).

If the override is nested, separate each nested level using a dot (.) in the path parameter. If there is an array as part of the nesting, specify the index in the path.

To include a literal . in the property name, prefix with a \. In most programming languages you will need to write this as "\\." because the \ itself will need to be escaped.

For example:

cfn_resource.add_override("Properties.GlobalSecondaryIndexes.0.Projection.NonKeyAttributes", ["myattribute"])
cfn_resource.add_override("Properties.GlobalSecondaryIndexes.1.ProjectionType", "INCLUDE")

would add the overrides Example:

"Properties": {
   "GlobalSecondaryIndexes": [
     {
       "Projection": {
         "NonKeyAttributes": [ "myattribute" ]
         ...
       }
       ...
     },
     {
       "ProjectionType": "INCLUDE"
       ...
     },
   ]
   ...
}

The value argument to addOverride will not be processed or translated in any way. Pass raw JSON values in here with the correct capitalization for CloudFormation. If you pass CDK classes or structs, they will be rendered with lowercased key names, and CloudFormation will reject the template.

Parameters
  • path (str) –

    • The path of the property, you can use dot notation to override values in complex types. Any intermdediate keys will be created as needed.

  • value (Any) –

    • The value. Could be primitive or complex.

Return type

None

add_property_deletion_override(property_path)

Adds an override that deletes the value of a property from the resource definition.

Parameters

property_path (str) – The path to the property.

Return type

None

add_property_override(property_path, value)

Adds an override to a resource property.

Syntactic sugar for addOverride("Properties.<...>", value).

Parameters
  • property_path (str) – The path of the property.

  • value (Any) – The value.

Return type

None

apply_removal_policy(policy=None, *, apply_to_update_replace_policy=None, default=None)

Sets the deletion policy of the resource based on the removal policy specified.

The Removal Policy controls what happens to this resource when it stops being managed by CloudFormation, either because you’ve removed it from the CDK application or because you’ve made a change that requires the resource to be replaced.

The resource can be deleted (RemovalPolicy.DESTROY), or left in your AWS account for data recovery and cleanup later (RemovalPolicy.RETAIN).

Parameters
  • policy (Optional[RemovalPolicy]) –

  • apply_to_update_replace_policy (Optional[bool]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: true

  • default (Optional[RemovalPolicy]) – The default policy to apply in case the removal policy is not defined. Default: - Default value is resource specific. To determine the default value for a resoure, please consult that specific resource’s documentation.

Return type

None

get_att(attribute_name)

Returns a token for an runtime attribute of this resource.

Ideally, use generated attribute accessors (e.g. resource.arn), but this can be used for future compatibility in case there is no generated attribute.

Parameters

attribute_name (str) – The name of the attribute.

Return type

Reference

get_metadata(key)

Retrieve a value value from the CloudFormation Resource Metadata.

Parameters

key (str) –

See

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/metadata-section-structure.html

Note that this is a different set of metadata from CDK node metadata; this metadata ends up in the stack template under the resource, whereas CDK node metadata ends up in the Cloud Assembly.

Return type

Any

inspect(inspector)

Examines the CloudFormation resource and discloses attributes.

Parameters

inspector (TreeInspector) –

  • tree inspector to collect and process attributes.

Return type

None

override_logical_id(new_logical_id)

Overrides the auto-generated logical ID with a specific ID.

Parameters

new_logical_id (str) – The new logical ID to use for this stack element.

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Returns

a string representation of this resource

Attributes

CFN_RESOURCE_TYPE_NAME = 'AWS::Lightsail::Instance'
add_ons

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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html#cfn-lightsail-instance-addons

Return type

Union[IResolvable, List[Union[IResolvable, AddOnProperty]], None]

attr_hardware_cpu_count

The number of vCPUs the instance has.

CloudformationAttribute

Hardware.CpuCount

Return type

Union[int, float]

attr_hardware_ram_size_in_gb

The amount of RAM in GB on the instance (for example, 1.0 ).

CloudformationAttribute

Hardware.RamSizeInGb

Return type

Union[int, float]

attr_instance_arn

The Amazon Resource Name (ARN) of the instance (for example, arn:aws:lightsail:us-east-2:123456789101:Instance/244ad76f-8aad-4741-809f-12345EXAMPLE ).

CloudformationAttribute

InstanceArn

Return type

str

attr_is_static_ip

A Boolean value indicating whether the instance has a static IP assigned to it.

CloudformationAttribute

IsStaticIp

Return type

IResolvable

attr_location_availability_zone

The AWS Region and Availability Zone where the instance is located.

CloudformationAttribute

Location.AvailabilityZone

Return type

str

attr_location_region_name

The AWS Region of the instance.

CloudformationAttribute

Location.RegionName

Return type

str

attr_networking_monthly_transfer_gb_per_month_allocated

The amount of allocated monthly data transfer (in GB) for an instance.

CloudformationAttribute

Networking.MonthlyTransfer.GbPerMonthAllocated

Return type

str

attr_private_ip_address

The private IP address of the instance.

CloudformationAttribute

PrivateIpAddress

Return type

str

attr_public_ip_address

The public IP address of the instance.

CloudformationAttribute

PublicIpAddress

Return type

str

attr_resource_type

The resource type of the instance (for example, Instance ).

CloudformationAttribute

ResourceType

Return type

str

attr_ssh_key_name

The name of the SSH key pair used by the instance.

CloudformationAttribute

SshKeyName

Return type

str

attr_state_code

The status code of the instance.

CloudformationAttribute

State.Code

Return type

Union[int, float]

attr_state_name

The state of the instance (for example, running or pending ).

CloudformationAttribute

State.Name

Return type

str

attr_support_code

The support code of the instance.

Include this code in your email to support when you have questions about an instance or another resource in Lightsail . This code helps our support team to look up your Lightsail information.

CloudformationAttribute

SupportCode

Return type

str

attr_user_name

The user name for connecting to the instance (for example, ec2-user ).

CloudformationAttribute

UserName

Return type

str

availability_zone

The Availability Zone for the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html#cfn-lightsail-instance-availabilityzone

Return type

Optional[str]

blueprint_id

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

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html#cfn-lightsail-instance-blueprintid

Return type

str

bundle_id

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

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html#cfn-lightsail-instance-bundleid

Return type

str

cfn_options

Options for this resource, such as condition, update policy etc.

Return type

ICfnResourceOptions

cfn_resource_type

AWS resource type.

Return type

str

creation_stack

return:

the stack trace of the point where this Resource was created from, sourced from the +metadata+ entry typed +aws:cdk:logicalId+, and with the bottom-most node +internal+ entries filtered.

Return type

List[str]

hardware

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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html#cfn-lightsail-instance-hardware

Return type

Union[IResolvable, HardwareProperty, None]

instance_name

The name of the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html#cfn-lightsail-instance-instancename

Return type

str

key_pair_name

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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html#cfn-lightsail-instance-keypairname

Return type

Optional[str]

logical_id

The logical ID for this CloudFormation stack element.

The logical ID of the element is calculated from the path of the resource node in the construct tree.

To override this value, use overrideLogicalId(newLogicalId).

Return type

str

Returns

the logical ID as a stringified token. This value will only get resolved during synthesis.

networking

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

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html#cfn-lightsail-instance-networking

Return type

Union[IResolvable, NetworkingProperty, None]

node

The construct tree node associated with this construct.

Return type

ConstructNode

ref

Return a string that will be resolved to a CloudFormation { Ref } for this element.

If, by any chance, the intrinsic reference of a resource is not a string, you could coerce it to an IResolvable through Lazy.any({ produce: resource.ref }).

Return type

str

stack

The stack in which this element is defined.

CfnElements must be defined within a stack scope (directly or indirectly).

Return type

Stack

tags

An array of key-value pairs to apply to this resource.

For more information, see Tag in the AWS CloudFormation User Guide . .. epigraph:

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

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html#cfn-lightsail-instance-tags

Return type

TagManager

user_data

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. .. epigraph:

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

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html#cfn-lightsail-instance-userdata

Return type

Optional[str]

Static Methods

classmethod is_cfn_element(x)

Returns true if a construct is a stack element (i.e. part of the synthesized cloudformation template).

Uses duck-typing instead of instanceof to allow stack elements from different versions of this library to be included in the same stack.

Parameters

x (Any) –

Return type

bool

Returns

The construct as a stack element or undefined if it is not a stack element.

classmethod is_cfn_resource(construct)

Check whether the given construct is a CfnResource.

Parameters

construct (IConstruct) –

Return type

bool

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool

AddOnProperty

class CfnInstance.AddOnProperty(*, add_on_type, auto_snapshot_add_on_request=None, status=None)

Bases: object

AddOn is a property of the AWS::Lightsail::Instance resource. It describes the add-ons for an instance.

Parameters
  • add_on_type (str) – The add-on type (for example, AutoSnapshot ). .. epigraph:: AutoSnapshot is the only add-on that can be enabled for an instance.

  • auto_snapshot_add_on_request (Union[IResolvable, AutoSnapshotAddOnProperty, None]) – The parameters for the automatic snapshot add-on, such as the daily time when an automatic snapshot will be created.

  • status (Optional[str]) – The status of the add-on. Valid Values: Enabled | Disabled

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-addon.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_lightsail as lightsail

add_on_property = lightsail.CfnInstance.AddOnProperty(
    add_on_type="addOnType",

    # the properties below are optional
    auto_snapshot_add_on_request=lightsail.CfnInstance.AutoSnapshotAddOnProperty(
        snapshot_time_of_day="snapshotTimeOfDay"
    ),
    status="status"
)

Attributes

add_on_type

The add-on type (for example, AutoSnapshot ).

AutoSnapshot is the only add-on that can be enabled for an instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-addon.html#cfn-lightsail-instance-addon-addontype

Return type

str

auto_snapshot_add_on_request

The parameters for the automatic snapshot add-on, such as the daily time when an automatic snapshot will be created.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-addon.html#cfn-lightsail-instance-addon-autosnapshotaddonrequest

Return type

Union[IResolvable, AutoSnapshotAddOnProperty, None]

status

The status of the add-on.

Valid Values: Enabled | Disabled

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-addon.html#cfn-lightsail-instance-addon-status

Return type

Optional[str]

AutoSnapshotAddOnProperty

class CfnInstance.AutoSnapshotAddOnProperty(*, snapshot_time_of_day=None)

Bases: object

AutoSnapshotAddOn is a property of the AddOn property. It describes the automatic snapshot add-on for an instance.

Parameters

snapshot_time_of_day (Optional[str]) – The daily time when an automatic snapshot will be created. Constraints: - Must be in HH:00 format, and in an hourly increment. - Specified in Coordinated Universal Time (UTC). - The snapshot will be automatically created between the time specified and up to 45 minutes after.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-autosnapshotaddon.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_lightsail as lightsail

auto_snapshot_add_on_property = lightsail.CfnInstance.AutoSnapshotAddOnProperty(
    snapshot_time_of_day="snapshotTimeOfDay"
)

Attributes

snapshot_time_of_day

The daily time when an automatic snapshot will be created.

Constraints:

  • Must be in HH:00 format, and in an hourly increment.

  • Specified in Coordinated Universal Time (UTC).

  • The snapshot will be automatically created between the time specified and up to 45 minutes after.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-autosnapshotaddon.html#cfn-lightsail-instance-autosnapshotaddon-snapshottimeofday

Return type

Optional[str]

DiskProperty

class CfnInstance.DiskProperty(*, disk_name, path, attached_to=None, attachment_state=None, iops=None, is_system_disk=None, size_in_gb=None)

Bases: object

Disk is a property of the Hardware property. It describes a disk attached to an instance.

Parameters
  • disk_name (str) – The unique name of the disk.

  • path (str) – The disk path.

  • attached_to (Optional[str]) – The resources to which the disk is attached.

  • attachment_state (Optional[str]) – (Deprecated) The attachment state of the disk. .. epigraph:: In releases prior to November 14, 2017, this parameter returned attached for system disks in the API response. It is now deprecated, but still included in the response. Use isAttached instead.

  • iops (Union[int, float, None]) – The input/output operations per second (IOPS) of the disk.

  • is_system_disk (Union[bool, IResolvable, None]) – A Boolean value indicating whether this disk is a system disk (has an operating system loaded on it).

  • size_in_gb (Optional[str]) – The size of the disk in GB.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-disk.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_lightsail as lightsail

disk_property = lightsail.CfnInstance.DiskProperty(
    disk_name="diskName",
    path="path",

    # the properties below are optional
    attached_to="attachedTo",
    attachment_state="attachmentState",
    iops=123,
    is_system_disk=False,
    size_in_gb="sizeInGb"
)

Attributes

attached_to

The resources to which the disk is attached.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-disk.html#cfn-lightsail-instance-disk-attachedto

Return type

Optional[str]

attachment_state

(Deprecated) The attachment state of the disk.

In releases prior to November 14, 2017, this parameter returned attached for system disks in the API response. It is now deprecated, but still included in the response. Use isAttached instead.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-disk.html#cfn-lightsail-instance-disk-attachmentstate

Return type

Optional[str]

disk_name

The unique name of the disk.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-disk.html#cfn-lightsail-instance-disk-diskname

Return type

str

iops

The input/output operations per second (IOPS) of the disk.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-disk.html#cfn-lightsail-instance-disk-iops

Return type

Union[int, float, None]

is_system_disk

A Boolean value indicating whether this disk is a system disk (has an operating system loaded on it).

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-disk.html#cfn-lightsail-instance-disk-issystemdisk

Return type

Union[bool, IResolvable, None]

path

The disk path.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-disk.html#cfn-lightsail-instance-disk-path

Return type

str

size_in_gb

The size of the disk in GB.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-disk.html#cfn-lightsail-instance-disk-sizeingb

Return type

Optional[str]

HardwareProperty

class CfnInstance.HardwareProperty(*, cpu_count=None, disks=None, ram_size_in_gb=None)

Bases: object

Hardware is a property of the AWS::Lightsail::Instance resource. It describes the hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.

Parameters
  • cpu_count (Union[int, float, None]) – The number of vCPUs the instance has. .. epigraph:: The CpuCount property is read-only and should not be specified in a create instance or update instance request.

  • disks (Union[IResolvable, Sequence[Union[IResolvable, DiskProperty]], None]) – The disks attached to the instance. 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.

  • ram_size_in_gb (Union[int, float, None]) – The amount of RAM in GB on the instance (for example, 1.0 ). .. epigraph:: The RamSizeInGb property is read-only and should not be specified in a create instance or update instance request.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-hardware.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_lightsail as lightsail

hardware_property = lightsail.CfnInstance.HardwareProperty(
    cpu_count=123,
    disks=[lightsail.CfnInstance.DiskProperty(
        disk_name="diskName",
        path="path",

        # the properties below are optional
        attached_to="attachedTo",
        attachment_state="attachmentState",
        iops=123,
        is_system_disk=False,
        size_in_gb="sizeInGb"
    )],
    ram_size_in_gb=123
)

Attributes

cpu_count

The number of vCPUs the instance has.

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

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-hardware.html#cfn-lightsail-instance-hardware-cpucount

Return type

Union[int, float, None]

disks

The disks attached to the instance.

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.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-hardware.html#cfn-lightsail-instance-hardware-disks

Return type

Union[IResolvable, List[Union[IResolvable, DiskProperty]], None]

ram_size_in_gb

The amount of RAM in GB on the instance (for example, 1.0 ).

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

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-hardware.html#cfn-lightsail-instance-hardware-ramsizeingb

Return type

Union[int, float, None]

LocationProperty

class CfnInstance.LocationProperty(*, availability_zone=None, region_name=None)

Bases: object

Location is a property of the AWS::Lightsail::Instance resource. It describes the location for an instance.

Parameters
  • availability_zone (Optional[str]) – The Availability Zone for the instance.

  • region_name (Optional[str]) – The name of the AWS Region for the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-location.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_lightsail as lightsail

location_property = lightsail.CfnInstance.LocationProperty(
    availability_zone="availabilityZone",
    region_name="regionName"
)

Attributes

availability_zone

The Availability Zone for the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-location.html#cfn-lightsail-instance-location-availabilityzone

Return type

Optional[str]

region_name

The name of the AWS Region for the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-location.html#cfn-lightsail-instance-location-regionname

Return type

Optional[str]

MonthlyTransferProperty

class CfnInstance.MonthlyTransferProperty(*, gb_per_month_allocated=None)

Bases: object

MonthlyTransfer is a property of the Networking property. It describes the amount of allocated monthly data transfer (in GB) for an instance.

Parameters

gb_per_month_allocated (Optional[str]) – The amount of allocated monthly data transfer (in GB) for an instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-monthlytransfer.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_lightsail as lightsail

monthly_transfer_property = lightsail.CfnInstance.MonthlyTransferProperty(
    gb_per_month_allocated="gbPerMonthAllocated"
)

Attributes

gb_per_month_allocated

The amount of allocated monthly data transfer (in GB) for an instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-monthlytransfer.html#cfn-lightsail-instance-monthlytransfer-gbpermonthallocated

Return type

Optional[str]

NetworkingProperty

class CfnInstance.NetworkingProperty(*, ports, monthly_transfer=None)

Bases: object

Networking is a property of the AWS::Lightsail::Instance resource. It describes the public ports and the monthly amount of data transfer allocated for the instance.

Parameters
  • ports (Union[IResolvable, Sequence[Union[IResolvable, PortProperty]]]) – An array of ports to open on the instance.

  • monthly_transfer (Union[int, float, None]) – The monthly amount of data transfer, in GB, allocated for the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-networking.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_lightsail as lightsail

networking_property = lightsail.CfnInstance.NetworkingProperty(
    ports=[lightsail.CfnInstance.PortProperty(
        access_direction="accessDirection",
        access_from="accessFrom",
        access_type="accessType",
        cidr_list_aliases=["cidrListAliases"],
        cidrs=["cidrs"],
        common_name="commonName",
        from_port=123,
        ipv6_cidrs=["ipv6Cidrs"],
        protocol="protocol",
        to_port=123
    )],

    # the properties below are optional
    monthly_transfer=123
)

Attributes

monthly_transfer

The monthly amount of data transfer, in GB, allocated for the instance.

Return type

Union[int, float, None]

ports

An array of ports to open on the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-networking.html#cfn-lightsail-instance-networking-ports

Return type

Union[IResolvable, List[Union[IResolvable, PortProperty]]]

PortProperty

class CfnInstance.PortProperty(*, access_direction=None, access_from=None, access_type=None, cidr_list_aliases=None, cidrs=None, common_name=None, from_port=None, ipv6_cidrs=None, protocol=None, to_port=None)

Bases: object

Port is a property of the Networking property. It describes information about ports for an instance.

Parameters
  • access_direction (Optional[str]) – The access direction ( inbound or outbound ). .. epigraph:: Lightsail currently supports only inbound access direction.

  • access_from (Optional[str]) – The location from which access is allowed. For example, Anywhere (0.0.0.0/0) , or Custom if a specific IP address or range of IP addresses is allowed.

  • access_type (Optional[str]) – The type of access ( Public or Private ).

  • cidr_list_aliases (Optional[Sequence[str]]) – An alias that defines access for a preconfigured range of IP addresses. The only alias currently supported is lightsail-connect , which allows IP addresses of the browser-based RDP/SSH client in the Lightsail console to connect to your instance.

  • cidrs (Optional[Sequence[str]]) – The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol. .. epigraph:: The ipv6Cidrs parameter lists the IPv6 addresses that are allowed to connect to an instance. Examples: - To allow the IP address 192.0.2.44 , specify 192.0.2.44 or 192.0.2.44/32 . - To allow the IP addresses 192.0.2.0 to 192.0.2.255 , specify 192.0.2.0/24 .

  • common_name (Optional[str]) – The common name of the port information.

  • from_port (Union[int, float, None]) – The first port in a range of open ports on an instance. Allowed ports: - TCP and UDP - 0 to 65535 - ICMP - The ICMP type for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. - ICMPv6 - The ICMP type for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code).

  • ipv6_cidrs (Optional[Sequence[str]]) – The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol. Only devices with an IPv6 address can connect to an instance through IPv6; otherwise, IPv4 should be used. .. epigraph:: The cidrs parameter lists the IPv4 addresses that are allowed to connect to an instance.

  • protocol (Optional[str]) – The IP protocol name. The name can be one of the following: - tcp - Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of streamed data between applications running on hosts communicating by an IP network. If you have an application that doesn’t require reliable data stream service, use UDP instead. - all - All transport layer protocol types. - udp - With User Datagram Protocol (UDP), computer applications can send messages (or datagrams) to other hosts on an Internet Protocol (IP) network. Prior communications are not required to set up transmission channels or data paths. Applications that don’t require reliable data stream service can use UDP, which provides a connectionless datagram service that emphasizes reduced latency over reliability. If you do require reliable data stream service, use TCP instead. - icmp - Internet Control Message Protocol (ICMP) is used to send error messages and operational information indicating success or failure when communicating with an instance. For example, an error is indicated when an instance could not be reached. When you specify icmp as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

  • to_port (Union[int, float, None]) – The last port in a range of open ports on an instance. Allowed ports: - TCP and UDP - 0 to 65535 - ICMP - The ICMP code for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping. - ICMPv6 - The ICMP code for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code).

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-port.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_lightsail as lightsail

port_property = lightsail.CfnInstance.PortProperty(
    access_direction="accessDirection",
    access_from="accessFrom",
    access_type="accessType",
    cidr_list_aliases=["cidrListAliases"],
    cidrs=["cidrs"],
    common_name="commonName",
    from_port=123,
    ipv6_cidrs=["ipv6Cidrs"],
    protocol="protocol",
    to_port=123
)

Attributes

access_direction

The access direction ( inbound or outbound ).

Lightsail currently supports only inbound access direction.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-port.html#cfn-lightsail-instance-port-accessdirection

Return type

Optional[str]

access_from

The location from which access is allowed.

For example, Anywhere (0.0.0.0/0) , or Custom if a specific IP address or range of IP addresses is allowed.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-port.html#cfn-lightsail-instance-port-accessfrom

Return type

Optional[str]

access_type

The type of access ( Public or Private ).

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-port.html#cfn-lightsail-instance-port-accesstype

Return type

Optional[str]

cidr_list_aliases

An alias that defines access for a preconfigured range of IP addresses.

The only alias currently supported is lightsail-connect , which allows IP addresses of the browser-based RDP/SSH client in the Lightsail console to connect to your instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-port.html#cfn-lightsail-instance-port-cidrlistaliases

Return type

Optional[List[str]]

cidrs

The IPv4 address, or range of IPv4 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol.

The ipv6Cidrs parameter lists the IPv6 addresses that are allowed to connect to an instance.

Examples:

  • To allow the IP address 192.0.2.44 , specify 192.0.2.44 or 192.0.2.44/32 .

  • To allow the IP addresses 192.0.2.0 to 192.0.2.255 , specify 192.0.2.0/24 .

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-port.html#cfn-lightsail-instance-port-cidrs

Return type

Optional[List[str]]

common_name

The common name of the port information.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-port.html#cfn-lightsail-instance-port-commonname

Return type

Optional[str]

from_port

The first port in a range of open ports on an instance.

Allowed ports:

  • TCP and UDP - 0 to 65535

  • ICMP - The ICMP type for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping.

  • ICMPv6 - The ICMP type for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code).

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-port.html#cfn-lightsail-instance-port-fromport

Return type

Union[int, float, None]

ipv6_cidrs

The IPv6 address, or range of IPv6 addresses (in CIDR notation) that are allowed to connect to an instance through the ports, and the protocol.

Only devices with an IPv6 address can connect to an instance through IPv6; otherwise, IPv4 should be used. .. epigraph:

The ``cidrs`` parameter lists the IPv4 addresses that are allowed to connect to an instance.
Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-port.html#cfn-lightsail-instance-port-ipv6cidrs

Return type

Optional[List[str]]

protocol

The IP protocol name.

The name can be one of the following:

  • tcp - Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of streamed data between applications running on hosts communicating by an IP network. If you have an application that doesn’t require reliable data stream service, use UDP instead.

  • all - All transport layer protocol types.

  • udp - With User Datagram Protocol (UDP), computer applications can send messages (or datagrams) to other hosts on an Internet Protocol (IP) network. Prior communications are not required to set up transmission channels or data paths. Applications that don’t require reliable data stream service can use UDP, which provides a connectionless datagram service that emphasizes reduced latency over reliability. If you do require reliable data stream service, use TCP instead.

  • icmp - Internet Control Message Protocol (ICMP) is used to send error messages and operational information indicating success or failure when communicating with an instance. For example, an error is indicated when an instance could not be reached. When you specify icmp as the protocol , you must specify the ICMP type using the fromPort parameter, and ICMP code using the toPort parameter.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-port.html#cfn-lightsail-instance-port-protocol

Return type

Optional[str]

to_port

The last port in a range of open ports on an instance.

Allowed ports:

  • TCP and UDP - 0 to 65535

  • ICMP - The ICMP code for IPv4 addresses. For example, specify 8 as the fromPort (ICMP type), and -1 as the toPort (ICMP code), to enable ICMP Ping.

  • ICMPv6 - The ICMP code for IPv6 addresses. For example, specify 128 as the fromPort (ICMPv6 type), and 0 as toPort (ICMPv6 code).

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-port.html#cfn-lightsail-instance-port-toport

Return type

Union[int, float, None]

StateProperty

class CfnInstance.StateProperty(*, code=None, name=None)

Bases: object

State is a property of the AWS::Lightsail::Instance resource. It describes the status code and the state (for example, running ) of an instance.

Parameters
  • code (Union[int, float, None]) – The status code of the instance.

  • name (Optional[str]) – The state of the instance (for example, running or pending ).

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-state.html

ExampleMetadata

fixture=_generated

Example:

# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
import aws_cdk.aws_lightsail as lightsail

state_property = lightsail.CfnInstance.StateProperty(
    code=123,
    name="name"
)

Attributes

code

The status code of the instance.

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-state.html#cfn-lightsail-instance-state-code

Return type

Union[int, float, None]

name

The state of the instance (for example, running or pending ).

Link

http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-properties-lightsail-instance-state.html#cfn-lightsail-instance-state-name

Return type

Optional[str]