BastionHostLinux

class aws_cdk.aws_ec2.BastionHostLinux(scope, id, *, vpc, availability_zone=None, instance_name=None, instance_type=None, security_group=None, subnet_selection=None)

Bases: aws_cdk.core.Construct

This creates a linux bastion host you can use to connect to other instances or services in your VPC. The recommended way to connect to the bastion host is by using AWS Systems Manager Session Manager.

The operating system is Amazon Linux 2 with the latest SSM agent installed

You can also configure this bastion host to allow connections via SSH

stability :stability: experimental

__init__(scope, id, *, vpc, availability_zone=None, instance_name=None, instance_type=None, security_group=None, subnet_selection=None)
Parameters
  • scope (Construct) –

  • id (str) –

  • props

  • vpc (IVpc) – VPC to launch the instance in.

  • availability_zone (Optional[str]) – In which AZ to place the instance within the VPC. Default: - Random zone.

  • instance_name (Optional[str]) – The name of the instance. Default: ‘BastionHost’

  • instance_type (Optional[InstanceType]) – Type of instance to launch. Default: ‘t3.nano’

  • security_group (Optional[ISecurityGroup]) – Security Group to assign to this instance. Default: - create new security group with no inbound and all outbound traffic allowed

  • subnet_selection (Optional[SubnetSelection]) – Select the subnets to run the bastion host in. Set this to PUBLIC if you need to connect to this instance via the internet and cannot use SSM. You have to allow port 22 manually by using the connections field. Default: - private subnets of the supplied VPC

stability :stability: experimental

Return type

None

Methods

allow_ssh_access_from(*peer)

Allow SSH access from the given peer or peers.

Necessary if you want to connect to the instance using ssh. If not called, you should use SSM Session Manager to connect to the instance.

Parameters

peer (IPeer) –

stability :stability: experimental

Return type

None

to_string()

Returns a string representation of this construct.

Return type

str

Attributes

connections

Allows specify security group connections for the instance.

stability :stability: experimental

Return type

Connections

grant_principal

The principal to grant permissions to.

stability :stability: experimental

Return type

IPrincipal

instance

The underlying instance resource.

stability :stability: experimental

Return type

Instance

instance_availability_zone

The availability zone the instance was launched in.

stability :stability: experimental attribute: :attribute:: true

Return type

str

instance_id

The instance’s ID.

stability :stability: experimental attribute: :attribute:: true

Return type

str

instance_private_dns_name

Private DNS name for this instance.

stability :stability: experimental attribute: :attribute:: true

Return type

str

instance_private_ip

Private IP for this instance.

stability :stability: experimental attribute: :attribute:: true

Return type

str

instance_public_dns_name

Publicly-routable DNS name for this instance.

(May be an empty string if the instance does not have a public name).

stability :stability: experimental attribute: :attribute:: true

Return type

str

instance_public_ip

Publicly-routable IP address for this instance.

(May be an empty string if the instance does not have a public IP).

stability :stability: experimental attribute: :attribute:: true

Return type

str

node

Construct tree node which offers APIs for interacting with the construct tree.

Return type

ConstructNode

role

The IAM role assumed by the instance.

stability :stability: experimental

Return type

IRole

stack

The stack in which this resource is defined.

stability :stability: experimental

Return type

Stack

Static Methods

classmethod is_construct(x)

Return whether the given object is a Construct.

Parameters

x (Any) –

Return type

bool