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, location=None, networking=None, state=None, tags=None, user_data=None)
Bases:
CfnResource
The
AWS::Lightsail::Instance
resource specifies an Amazon Lightsail instance.- See:
http://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/aws-resource-lightsail-instance.html
- CloudformationResource:
AWS::Lightsail::Instance
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import 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", location=lightsail.CfnInstance.LocationProperty( availability_zone="availabilityZone", region_name="regionName" ), 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=lightsail.CfnInstance.MonthlyTransferProperty( gb_per_month_allocated="gbPerMonthAllocated" ) ), state=lightsail.CfnInstance.StateProperty( code=123, name="name" ), tags=[CfnTag( key="key", value="value" )], user_data="userData" )
- Parameters:
scope (
Construct
) – Scope in which this resource is defined.id (
str
) – Construct identifier for this resource (unique in its scope).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
,Dict
[str
,Any
]]],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
,Dict
[str
,Any
],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.location (
Union
[IResolvable
,LocationProperty
,Dict
[str
,Any
],None
]) – The location for the instance, such as the AWS Region and Availability Zone. .. epigraph:: TheLocation
property is read-only and should not be specified in a create instance or update instance request.networking (
Union
[IResolvable
,NetworkingProperty
,Dict
[str
,Any
],None
]) – The public ports and the monthly amount of data transfer allocated for the instance.state (
Union
[IResolvable
,StateProperty
,Dict
[str
,Any
],None
]) – The status code and the state (for example,running
) of the instance. .. epigraph:: TheState
property is read-only and should not be specified in a create instance or update instance request.tags (
Optional
[Sequence
[Union
[CfnTag
,Dict
[str
,Any
]]]]) – An array of key-value pairs to apply to this resource. For more information, see Tag in the AWS CloudFormation User Guide . .. epigraph:: TheValue
ofTags
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 specifyapt-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 useyum
, Debian and Ubuntu useapt-get
, and FreeBSD usespkg
.
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_dependency(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_depends_on(target)
(deprecated) Indicates that this resource depends on another resource and cannot be provisioned unless the other resource has been successfully provisioned.
- Parameters:
target (
CfnResource
) –- Deprecated:
use addDependency
- Stability:
deprecated
- Return type:
None
- add_metadata(key, value)
Add a value to the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –value (
Any
) –
- See:
- Return type:
None
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.
- add_override(path, value)
Adds an override to the synthesized CloudFormation resource.
To add a property override, either use
addPropertyOverride
or prefixpath
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 toaddOverride
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 intermediate 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
). In some cases, a snapshot can be taken of the resource prior to deletion (RemovalPolicy.SNAPSHOT
). A list of resources that support this policy can be found in the following link:- Parameters:
policy (
Optional
[RemovalPolicy
]) –apply_to_update_replace_policy (
Optional
[bool
]) – Apply the same deletion policy to the resource’s “UpdateReplacePolicy”. Default: truedefault (
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 resource, please consult that specific resource’s documentation.
- See:
- Return type:
None
- get_att(attribute_name, type_hint=None)
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.type_hint (
Optional
[ResolutionTypeHint
]) –
- Return type:
- get_metadata(key)
Retrieve a value value from the CloudFormation Resource Metadata.
- Parameters:
key (
str
) –- See:
- Return type:
Any
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.
- inspect(inspector)
Examines the CloudFormation resource and discloses attributes.
- Parameters:
inspector (
TreeInspector
) – tree inspector to collect and process attributes.- Return type:
None
- obtain_dependencies()
Retrieves an array of resources this resource depends on.
This assembles dependencies on resources across stacks (including nested stacks) automatically.
- Return type:
List
[Union
[Stack
,CfnResource
]]
- obtain_resource_dependencies()
Get a shallow copy of dependencies between this resource and other resources in the same stack.
- Return type:
List
[CfnResource
]
- 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
- remove_dependency(target)
Indicates that this resource no longer depends on another resource.
This can be used for resources across stacks (including nested stacks) and the dependency will automatically be removed from the relevant scope.
- Parameters:
target (
CfnResource
) –- Return type:
None
- replace_dependency(target, new_target)
Replaces one dependency with another.
- Parameters:
target (
CfnResource
) – The dependency to replace.new_target (
CfnResource
) – The new dependency to add.
- 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.
- attr_hardware_cpu_count
The number of vCPUs the instance has.
- CloudformationAttribute:
Hardware.CpuCount
- attr_hardware_ram_size_in_gb
The amount of RAM in GB on the instance (for example,
1.0
).- CloudformationAttribute:
Hardware.RamSizeInGb
- 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
- attr_ipv6_addresses
The IPv6 addresses of the instance.
- CloudformationAttribute:
Ipv6Addresses
- attr_is_static_ip
A Boolean value indicating whether the instance has a static IP assigned to it.
- CloudformationAttribute:
IsStaticIp
- attr_location_availability_zone
The AWS Region and Availability Zone where the instance is located.
- CloudformationAttribute:
Location.AvailabilityZone
- attr_location_region_name
The AWS Region of the instance.
- CloudformationAttribute:
Location.RegionName
- attr_networking_monthly_transfer_gb_per_month_allocated
The amount of allocated monthly data transfer (in GB) for an instance.
- CloudformationAttribute:
Networking.MonthlyTransfer.GbPerMonthAllocated
- attr_private_ip_address
The private IP address of the instance.
- CloudformationAttribute:
PrivateIpAddress
- attr_public_ip_address
The public IP address of the instance.
- CloudformationAttribute:
PublicIpAddress
- attr_resource_type
The resource type of the instance (for example,
Instance
).- CloudformationAttribute:
ResourceType
- attr_ssh_key_name
The name of the SSH key pair used by the instance.
- CloudformationAttribute:
SshKeyName
- attr_state_code
The status code of the instance.
- CloudformationAttribute:
State.Code
- attr_state_name
The state of the instance (for example,
running
orpending
).- CloudformationAttribute:
State.Name
- 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
- attr_user_name
The user name for connecting to the instance (for example,
ec2-user
).- CloudformationAttribute:
UserName
- availability_zone
The Availability Zone for the instance.
- blueprint_id
The blueprint ID for the instance (for example,
os_amlinux_2016_03
).
- bundle_id
The bundle ID for the instance (for example,
micro_1_0
).
- cfn_options
Options for this resource, such as condition, update policy etc.
- cfn_resource_type
AWS resource type.
- 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.
- hardware
The hardware properties for the instance, such as the vCPU count, attached disks, and amount of RAM.
- instance_name
The name of the instance.
- key_pair_name
The name of the key pair to use for the instance.
- location
The location for the instance, such as the AWS Region and Availability Zone.
- 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)
.- 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.
- node
The tree node.
- 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 })
.
- stack
The stack in which this element is defined.
CfnElements must be defined within a stack scope (directly or indirectly).
- state
The status code and the state (for example,
running
) of the instance.
- tags
Tag Manager which manages the tags for this resource.
- tags_raw
An array of key-value pairs to apply to this resource.
- user_data
The optional launch script for the instance.
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(x)
Check whether the given object is a CfnResource.
- Parameters:
x (
Any
) –- Return type:
bool
- classmethod is_construct(x)
Checks if
x
is a construct.Use this method instead of
instanceof
to properly detectConstruct
instances, even when the construct library is symlinked.Explanation: in JavaScript, multiple copies of the
constructs
library on disk are seen as independent, completely different libraries. As a consequence, the classConstruct
in each copy of theconstructs
library is seen as a different class, and an instance of one class will not test asinstanceof
the other class.npm install
will not create installations like this, but users may manually symlink construct libraries together or use a monorepo tool: in those cases, multiple copies of theconstructs
library can be accidentally installed, andinstanceof
will behave unpredictably. It is safest to avoid usinginstanceof
, and using this type-testing method instead.- Parameters:
x (
Any
) – Any object.- Return type:
bool
- Returns:
true if
x
is an object created from a class which extendsConstruct
.
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
,Dict
[str
,Any
],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
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import 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.
- 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.
- status
The status of the add-on.
Valid Values:
Enabled
|Disabled
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 inHH: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.- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import 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.
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 returnedattached
for system disks in the API response. It is now deprecated, but still included in the response. UseisAttached
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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import 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.
- 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. UseisAttached
instead.
- disk_name
The unique name of the disk.
- iops
The input/output operations per second (IOPS) of the disk.
- is_system_disk
A Boolean value indicating whether this disk is a system disk (has an operating system loaded on it).
- path
The disk path.
- size_in_gb
The size of the disk in GB.
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:: TheCpuCount
property is read-only and should not be specified in a create instance or update instance request.disks (
Union
[IResolvable
,Sequence
[Union
[IResolvable
,DiskProperty
,Dict
[str
,Any
]]],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:: TheRamSizeInGb
property is read-only and should not be specified in a create instance or update instance request.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import 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.
- 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.
- 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.
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.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_lightsail as lightsail location_property = lightsail.CfnInstance.LocationProperty( availability_zone="availabilityZone", region_name="regionName" )
Attributes
- availability_zone
The Availability Zone for the instance.
- region_name
The name of the AWS Region for the instance.
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.- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import 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.
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
,Dict
[str
,Any
]]]]) – An array of ports to open on the instance.monthly_transfer (
Union
[IResolvable
,MonthlyTransferProperty
,Dict
[str
,Any
],None
]) – The monthly amount of data transfer, in GB, allocated for the instance.
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import 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=lightsail.CfnInstance.MonthlyTransferProperty( gb_per_month_allocated="gbPerMonthAllocated" ) )
Attributes
- monthly_transfer
The monthly amount of data transfer, in GB, allocated for the instance.
- ports
An array of ports to open on the instance.
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
oroutbound
). .. epigraph:: Lightsail currently supports onlyinbound
access direction.access_from (
Optional
[str
]) – The location from which access is allowed. For example,Anywhere (0.0.0.0/0)
, orCustom
if a specific IP address or range of IP addresses is allowed.access_type (
Optional
[str
]) – The type of access (Public
orPrivate
).cidr_list_aliases (
Optional
[Sequence
[str
]]) – An alias that defines access for a preconfigured range of IP addresses. The only alias currently supported islightsail-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:: Theipv6Cidrs
parameter lists the IPv6 addresses that are allowed to connect to an instance. Examples: - To allow the IP address192.0.2.44
, specify192.0.2.44
or192.0.2.44/32
. - To allow the IP addresses192.0.2.0
to192.0.2.255
, specify192.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
to65535
- ICMP - The ICMP type for IPv4 addresses. For example, specify8
as thefromPort
(ICMP type), and-1
as thetoPort
(ICMP code), to enable ICMP Ping. - ICMPv6 - The ICMP type for IPv6 addresses. For example, specify128
as thefromPort
(ICMPv6 type), and0
astoPort
(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:: Thecidrs
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 specifyicmp
as theprotocol
, you must specify the ICMP type using thefromPort
parameter, and ICMP code using thetoPort
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
to65535
- ICMP - The ICMP code for IPv4 addresses. For example, specify8
as thefromPort
(ICMP type), and-1
as thetoPort
(ICMP code), to enable ICMP Ping. - ICMPv6 - The ICMP code for IPv6 addresses. For example, specify128
as thefromPort
(ICMPv6 type), and0
astoPort
(ICMPv6 code).
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import 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
oroutbound
).Lightsail currently supports only
inbound
access direction.
- access_from
The location from which access is allowed.
For example,
Anywhere (0.0.0.0/0)
, orCustom
if a specific IP address or range of IP addresses is allowed.
- access_type
The type of access (
Public
orPrivate
).
- 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.
- 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
, specify192.0.2.44
or192.0.2.44/32
.To allow the IP addresses
192.0.2.0
to192.0.2.255
, specify192.0.2.0/24
.
- common_name
The common name of the port information.
- from_port
The first port in a range of open ports on an instance.
Allowed ports:
TCP and UDP -
0
to65535
ICMP - The ICMP type for IPv4 addresses. For example, specify
8
as thefromPort
(ICMP type), and-1
as thetoPort
(ICMP code), to enable ICMP Ping.ICMPv6 - The ICMP type for IPv6 addresses. For example, specify
128
as thefromPort
(ICMPv6 type), and0
astoPort
(ICMPv6 code).
- 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.
- 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 specifyicmp
as theprotocol
, you must specify the ICMP type using thefromPort
parameter, and ICMP code using thetoPort
parameter.
- to_port
The last port in a range of open ports on an instance.
Allowed ports:
TCP and UDP -
0
to65535
ICMP - The ICMP code for IPv4 addresses. For example, specify
8
as thefromPort
(ICMP type), and-1
as thetoPort
(ICMP code), to enable ICMP Ping.ICMPv6 - The ICMP code for IPv6 addresses. For example, specify
128
as thefromPort
(ICMPv6 type), and0
astoPort
(ICMPv6 code).
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
orpending
).
- See:
- ExampleMetadata:
fixture=_generated
Example:
# The code below shows an example of how to instantiate this type. # The values are placeholders you should change. from aws_cdk import aws_lightsail as lightsail state_property = lightsail.CfnInstance.StateProperty( code=123, name="name" )
Attributes
- code
The status code of the instance.
- name
The state of the instance (for example,
running
orpending
).