interface BastionHostLinuxProps
Language | Type name |
---|---|
![]() | Amazon.CDK.AWS.EC2.BastionHostLinuxProps |
![]() | github.com/aws/aws-cdk-go/awscdk/v2/awsec2#BastionHostLinuxProps |
![]() | software.amazon.awscdk.services.ec2.BastionHostLinuxProps |
![]() | aws_cdk.aws_ec2.BastionHostLinuxProps |
![]() | aws-cdk-lib » aws_ec2 » BastionHostLinuxProps |
Properties of the bastion host.
Example
const host = new ec2.BastionHostLinux(this, 'BastionHost', {
vpc,
blockDevices: [{
deviceName: '/dev/sdh',
volume: ec2.BlockDeviceVolume.ebs(10, {
encrypted: true,
}),
}],
});
Properties
Name | Type | Description |
---|---|---|
vpc | IVpc | VPC to launch the instance in. |
availability | string | In which AZ to place the instance within the VPC. |
block | Block [] | Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes. |
init? | Cloud | Apply the given CloudFormation Init configuration to the instance at startup. |
init | Apply | Use the given options for applying CloudFormation Init. |
instance | string | The name of the instance. |
instance | Instance | Type of instance to launch. |
machine | IMachine | The machine image to use, assumed to have SSM Agent preinstalled. |
require | boolean | Whether IMDSv2 should be required on this instance. |
security | ISecurity | Security Group to assign to this instance. |
subnet | Subnet | Select the subnets to run the bastion host in. |
user | boolean | Determines whether changes to the UserData will force instance replacement. |
vpc
Type:
IVpc
VPC to launch the instance in.
availabilityZone?
Type:
string
(optional, default: Random zone.)
In which AZ to place the instance within the VPC.
blockDevices?
Type:
Block
[]
(optional, default: Uses the block device mapping of the AMI)
Specifies how block devices are exposed to the instance. You can specify virtual devices and EBS volumes.
Each instance that is launched has an associated root device volume, either an Amazon EBS volume or an instance store volume. You can use block device mappings to specify additional EBS volumes or instance store volumes to attach to an instance when it is launched.
init?
Type:
Cloud
(optional, default: no CloudFormation init)
Apply the given CloudFormation Init configuration to the instance at startup.
initOptions?
Type:
Apply
(optional, default: default options)
Use the given options for applying CloudFormation Init.
Describes the configsets to use and the timeout to wait
instanceName?
Type:
string
(optional, default: 'BastionHost')
The name of the instance.
instanceType?
Type:
Instance
(optional, default: 't3.nano')
Type of instance to launch.
machineImage?
Type:
IMachine
(optional, default: An Amazon Linux 2023 image if the @aws-cdk/aws-ec2:bastionHostUseAmazonLinux2023ByDefault
feature flag is enabled. Otherwise, an Amazon Linux 2 image. In both cases, the image is kept up-to-date automatically (the instance
may be replaced on every deployment) and already has SSM Agent installed.)
The machine image to use, assumed to have SSM Agent preinstalled.
requireImdsv2?
Type:
boolean
(optional, default: false)
Whether IMDSv2 should be required on this instance.
securityGroup?
Type:
ISecurity
(optional, default: create new security group with no inbound and all outbound traffic allowed)
Security Group to assign to this instance.
subnetSelection?
Type:
Subnet
(optional, default: private subnets of the supplied VPC)
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
userDataCausesReplacement?
Type:
boolean
(optional, default: true
if initOptions
is specified, otherwise false
.)
Determines whether changes to the UserData will force instance replacement.
Depending on the EC2 instance type, modifying the UserData may either restart or replace the instance:
- Instance store-backed instances are replaced.
- EBS-backed instances are restarted.
Note that by default, restarting does not execute the updated UserData, so an alternative mechanism is needed to ensure the instance re-executes the UserData.
When set to true
, the instance's Logical ID will depend on the UserData, causing
CloudFormation to replace the instance if the UserData changes.