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, IGrantable, software.amazon.jsii.JsiiSerializable, software.constructs.IConstruct, software.constructs.IDependable

@Generated(value="jsii-pacmak/1.98.0 (build 00b106d)", date="2024-05-17T05:10:09.485Z") @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();
 
  • 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

      @Stability(Stable) public void allowSshAccessFrom(@NotNull @NotNull IPeer... 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 - This parameter is required.
    • getConnections

      @Stability(Stable) @NotNull public Connections getConnections()
      Allows specify security group connections for the instance.
      Specified by:
      getConnections in interface IConnectable
    • getGrantPrincipal

      @Stability(Stable) @NotNull public IPrincipal getGrantPrincipal()
      The principal to grant permissions to.
      Specified by:
      getGrantPrincipal in interface IGrantable
    • getInstance

      @Stability(Stable) @NotNull public Instance getInstance()
      The underlying instance resource.
    • getInstanceAvailabilityZone

      @Stability(Stable) @NotNull public String getInstanceAvailabilityZone()
      The availability zone the instance was launched in.
      Specified by:
      getInstanceAvailabilityZone in interface IInstance
    • getInstanceId

      @Stability(Stable) @NotNull public String getInstanceId()
      The instance's ID.
      Specified by:
      getInstanceId in interface IInstance
    • getInstancePrivateDnsName

      @Stability(Stable) @NotNull public String getInstancePrivateDnsName()
      Private DNS name for this instance.
      Specified by:
      getInstancePrivateDnsName in interface IInstance
    • getInstancePrivateIp

      @Stability(Stable) @NotNull public String getInstancePrivateIp()
      Private IP for this instance.
      Specified by:
      getInstancePrivateIp in interface IInstance
    • getInstancePublicDnsName

      @Stability(Stable) @NotNull public String getInstancePublicDnsName()
      Publicly-routable DNS name for this instance.

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

      Specified by:
      getInstancePublicDnsName in interface IInstance
    • getInstancePublicIp

      @Stability(Stable) @NotNull public String getInstancePublicIp()
      Publicly-routable IP address for this instance.

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

      Specified by:
      getInstancePublicIp in interface IInstance
    • getRole

      @Stability(Stable) @NotNull public IRole getRole()
      The IAM role assumed by the instance.
    • getStack

      @Stability(Stable) @NotNull public Stack getStack()
      The stack in which this resource is defined.
      Specified by:
      getStack in interface IResource
      Overrides:
      getStack in class Resource