Class BastionHostLinux
java.lang.Object
software.amazon.jsii.JsiiObject
software.constructs.Construct
software.amazon.awscdk.Resource
software.amazon.awscdk.services.ec2.BastionHostLinux
- All Implemented Interfaces:
IResource,IConnectable,IInstance,IInstanceRef,IGrantable,software.amazon.jsii.JsiiSerializable,software.constructs.IConstruct,software.constructs.IDependable
@Generated(value="jsii-pacmak/1.113.0 (build fc68b25)",
date="2025-10-14T12:28:09.084Z")
@Stability(Stable)
public class BastionHostLinux
extends Resource
implements IInstance
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
Example:
BastionHostLinux host = BastionHostLinux.Builder.create(this, "BastionHost")
.vpc(vpc)
.blockDevices(List.of(BlockDevice.builder()
.deviceName("/dev/sdh")
.volume(BlockDeviceVolume.ebs(10, EbsDeviceOptions.builder()
.encrypted(true)
.build()))
.build()))
.build();
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from class software.amazon.jsii.JsiiObject
software.amazon.jsii.JsiiObject.InitializationModeNested classes/interfaces inherited from interface software.constructs.IConstruct
software.constructs.IConstruct.Jsii$DefaultNested classes/interfaces inherited from interface software.amazon.awscdk.services.ec2.IInstance
IInstance.Jsii$Default, IInstance.Jsii$ProxyNested classes/interfaces inherited from interface software.amazon.awscdk.IResource
IResource.Jsii$Default -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedBastionHostLinux(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) protectedBastionHostLinux(software.amazon.jsii.JsiiObjectRef objRef) BastionHostLinux(software.constructs.Construct scope, String id, BastionHostLinuxProps props) -
Method Summary
Modifier and TypeMethodDescriptionvoidallowSshAccessFrom(IPeer... peer) Allow SSH access from the given peer or peers.Allows specify security group connections for the instance.The principal to grant permissions to.The underlying instance resource.The availability zone the instance was launched in.The instance's ID.Private DNS name for this instance.Private IP for this instance.Publicly-routable DNS name for this instance.Publicly-routable IP address for this instance.A reference to a Instance resource.getRole()The IAM role assumed by the instance.getStack()The stack in which this resource is defined.Methods inherited from class software.amazon.awscdk.Resource
applyRemovalPolicy, generatePhysicalName, getEnv, getPhysicalName, getResourceArnAttribute, getResourceNameAttribute, isOwnedResource, isResourceMethods inherited from class software.constructs.Construct
getNode, isConstruct, toStringMethods inherited from class software.amazon.jsii.JsiiObject
jsiiAsyncCall, jsiiAsyncCall, jsiiCall, jsiiCall, jsiiGet, jsiiGet, jsiiSet, jsiiStaticCall, jsiiStaticCall, jsiiStaticGet, jsiiStaticGet, jsiiStaticSet, jsiiStaticSetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface software.amazon.awscdk.IResource
applyRemovalPolicy, getEnvMethods inherited from interface software.amazon.jsii.JsiiSerializable
$jsii$toJson
-
Field Details
-
PROPERTY_INJECTION_ID
Uniquely identifies this class.
-
-
Constructor Details
-
BastionHostLinux
protected BastionHostLinux(software.amazon.jsii.JsiiObjectRef objRef) -
BastionHostLinux
protected BastionHostLinux(software.amazon.jsii.JsiiObject.InitializationMode initializationMode) -
BastionHostLinux
@Stability(Stable) public BastionHostLinux(@NotNull software.constructs.Construct scope, @NotNull String id, @NotNull BastionHostLinuxProps props) - Parameters:
scope- This parameter is required.id- This parameter is required.props- This parameter is required.
-
-
Method Details
-
allowSshAccessFrom
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- This parameter is required.
-
getConnections
Allows specify security group connections for the instance.- Specified by:
getConnectionsin interfaceIConnectable
-
getGrantPrincipal
The principal to grant permissions to.- Specified by:
getGrantPrincipalin interfaceIGrantable
-
getInstance
The underlying instance resource. -
getInstanceAvailabilityZone
The availability zone the instance was launched in.- Specified by:
getInstanceAvailabilityZonein interfaceIInstance
-
getInstanceId
The instance's ID.- Specified by:
getInstanceIdin interfaceIInstance
-
getInstancePrivateDnsName
Private DNS name for this instance.- Specified by:
getInstancePrivateDnsNamein interfaceIInstance
-
getInstancePrivateIp
Private IP for this instance.- Specified by:
getInstancePrivateIpin interfaceIInstance
-
getInstancePublicDnsName
Publicly-routable DNS name for this instance.(May be an empty string if the instance does not have a public name).
- Specified by:
getInstancePublicDnsNamein interfaceIInstance
-
getInstancePublicIp
Publicly-routable IP address for this instance.(May be an empty string if the instance does not have a public IP).
- Specified by:
getInstancePublicIpin interfaceIInstance
-
getInstanceRef
A reference to a Instance resource.- Specified by:
getInstanceRefin interfaceIInstanceRef
-
getRole
The IAM role assumed by the instance. -
getStack
The stack in which this resource is defined.
-