Class BastionHostLinux
This creates a linux bastion host you can use to connect to other instances or services in your VPC.
Inherited Members
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class BastionHostLinux : Resource, IInstance, IResource, IConnectable, IGrantable
Syntax (vb)
Public Class BastionHostLinux
Inherits Resource
Implements IInstance, IResource, IConnectable, IGrantable
Remarks
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
Resource: AWS::EC2::Instance
ExampleMetadata: fixture=with-vpc infused
Examples
var host = new BastionHostLinux(this, "BastionHost", new BastionHostLinuxProps {
Vpc = vpc,
BlockDevices = new [] { new BlockDevice {
DeviceName = "/dev/sdh",
Volume = BlockDeviceVolume.Ebs(10, new EbsDeviceOptions {
Encrypted = true
})
} }
});
Synopsis
Constructors
BastionHostLinux(ByRefValue) | Used by jsii to construct an instance of this class from a Javascript-owned object reference |
BastionHostLinux(DeputyBase.DeputyProps) | Used by jsii to construct an instance of this class from DeputyProps |
BastionHostLinux(Construct, String, IBastionHostLinuxProps) |
Properties
Connections | Allows specify security group connections for the instance. |
GrantPrincipal | The principal to grant permissions to. |
Instance | The underlying instance resource. |
InstanceAvailabilityZone | The availability zone the instance was launched in. |
InstanceId | The instance's ID. |
InstancePrivateDnsName | Private DNS name for this instance. |
InstancePrivateIp | Private IP for this instance. |
InstancePublicDnsName | Publicly-routable DNS name for this instance. |
InstancePublicIp | Publicly-routable IP address for this instance. |
Role | The IAM role assumed by the instance. |
Stack | The stack in which this resource is defined. |
Methods
AllowSshAccessFrom(IPeer[]) | Allow SSH access from the given peer or peers. |
Constructors
BastionHostLinux(ByRefValue)
Used by jsii to construct an instance of this class from a Javascript-owned object reference
protected BastionHostLinux(ByRefValue reference)
Parameters
- reference Amazon.JSII.Runtime.Deputy.ByRefValue
The Javascript-owned object reference
BastionHostLinux(DeputyBase.DeputyProps)
Used by jsii to construct an instance of this class from DeputyProps
protected BastionHostLinux(DeputyBase.DeputyProps props)
Parameters
- props Amazon.JSII.Runtime.Deputy.DeputyBase.DeputyProps
The deputy props
BastionHostLinux(Construct, String, IBastionHostLinuxProps)
public BastionHostLinux(Construct scope, string id, IBastionHostLinuxProps props)
Parameters
- scope Constructs.Construct
- id System.String
- props IBastionHostLinuxProps
Properties
Connections
Allows specify security group connections for the instance.
public virtual Connections_ Connections { get; }
Property Value
GrantPrincipal
The principal to grant permissions to.
public virtual IPrincipal GrantPrincipal { get; }
Property Value
Instance
The underlying instance resource.
public virtual Instance_ Instance { get; }
Property Value
InstanceAvailabilityZone
The availability zone the instance was launched in.
public virtual string InstanceAvailabilityZone { get; }
Property Value
System.String
Remarks
Attribute: true
InstanceId
The instance's ID.
public virtual string InstanceId { get; }
Property Value
System.String
Remarks
Attribute: true
InstancePrivateDnsName
Private DNS name for this instance.
public virtual string InstancePrivateDnsName { get; }
Property Value
System.String
Remarks
Attribute: true
InstancePrivateIp
Private IP for this instance.
public virtual string InstancePrivateIp { get; }
Property Value
System.String
Remarks
Attribute: true
InstancePublicDnsName
Publicly-routable DNS name for this instance.
public virtual string InstancePublicDnsName { get; }
Property Value
System.String
Remarks
(May be an empty string if the instance does not have a public name).
Attribute: true
InstancePublicIp
Publicly-routable IP address for this instance.
public virtual string InstancePublicIp { get; }
Property Value
System.String
Remarks
(May be an empty string if the instance does not have a public IP).
Attribute: true
Role
Stack
The stack in which this resource is defined.
public override Stack Stack { get; }
Property Value
Overrides
Methods
AllowSshAccessFrom(IPeer[])
Allow SSH access from the given peer or peers.
public virtual void AllowSshAccessFrom(params IPeer[] peer)
Parameters
- peer IPeer[]
Remarks
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.