Created
March 7, 2022 19:01
-
-
Save youngsoul/f313c07516669052d797b2a1cc75f6f4 to your computer and use it in GitHub Desktop.
CDK EC2 Instance Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
self.bastion_host = ec2.Instance(self, id=f'{resources_prefix}-bastion-host', | |
instance_type=ec2.InstanceType(instance_type_identifier='t2.micro'), | |
machine_image=ec2.AmazonLinuxImage( | |
edition=ec2.AmazonLinuxEdition.STANDARD, | |
generation=ec2.AmazonLinuxGeneration.AMAZON_LINUX_2, | |
virtualization=ec2.AmazonLinuxVirt.HVM, | |
storage=ec2.AmazonLinuxStorage.GENERAL_PURPOSE | |
), | |
vpc=self.vpc, | |
key_name='pryan-aws', # must create the key name manually first | |
vpc_subnets=ec2.SubnetSelection( | |
subnet_type=ec2.SubnetType.PUBLIC | |
), | |
security_group=self.bastion_sg | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment