Class BastionHostLinux
This creates a linux bastion host you can use to connect to other instances or services in your VPC.
Implements
Inherited Members
Namespace: Amazon.CDK.AWS.EC2
Assembly: Amazon.CDK.Lib.dll
Syntax (csharp)
public class BastionHostLinux : Resource, IInstance, IResource, IConnectable, IGrantable, IInstanceRef, IConstruct, IDependable, IEnvironmentAware
Syntax (vb)
Public Class BastionHostLinux Inherits Resource Implements IInstance, IResource, IConnectable, IGrantable, IInstanceRef, IConstruct, IDependable, IEnvironmentAware
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(Construct, string, IBastionHostLinuxProps) | This creates a linux bastion host you can use to connect to other instances or services in your VPC. |
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. |
| InstanceRef | A reference to a Instance resource. |
| PROPERTY_INJECTION_ID | Uniquely identifies this class. |
| Role | The IAM role assumed by the instance. |
| Stack | The stack in which this resource is defined. |
Methods
| AllowSshAccessFrom(params IPeer[]) | Allow SSH access from the given peer or peers. |
Constructors
BastionHostLinux(Construct, string, IBastionHostLinuxProps)
This creates a linux bastion host you can use to connect to other instances or services in your VPC.
public BastionHostLinux(Construct scope, string id, IBastionHostLinuxProps props)
Parameters
- scope Construct
- id string
- props IBastionHostLinuxProps
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
})
} }
});
Properties
Connections
Allows specify security group connections for the instance.
public virtual Connections_ Connections { get; }
Property Value
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
GrantPrincipal
The principal to grant permissions to.
public virtual IPrincipal GrantPrincipal { get; }
Property Value
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
Instance
The underlying instance resource.
public virtual Instance_ Instance { get; }
Property Value
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
InstanceAvailabilityZone
The availability zone the instance was launched in.
public virtual string InstanceAvailabilityZone { get; }
Property Value
Remarks
Attribute: true
InstanceId
The instance's ID.
public virtual string InstanceId { get; }
Property Value
Remarks
Attribute: true
InstancePrivateDnsName
Private DNS name for this instance.
public virtual string InstancePrivateDnsName { get; }
Property Value
Remarks
Attribute: true
InstancePrivateIp
Private IP for this instance.
public virtual string InstancePrivateIp { get; }
Property Value
Remarks
Attribute: true
InstancePublicDnsName
Publicly-routable DNS name for this instance.
public virtual string InstancePublicDnsName { get; }
Property Value
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
Remarks
(May be an empty string if the instance does not have a public IP).
Attribute: true
InstanceRef
A reference to a Instance resource.
public virtual IInstanceReference InstanceRef { get; }
Property Value
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
PROPERTY_INJECTION_ID
Uniquely identifies this class.
public static string PROPERTY_INJECTION_ID { get; }
Property Value
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
Role
The IAM role assumed by the instance.
public virtual IRole Role { get; }
Property Value
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
Stack
The stack in which this resource is defined.
public override Stack Stack { get; }
Property Value
Overrides
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
Methods
AllowSshAccessFrom(params 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.