constructor()

in source/resources/lib/cl-jumpbox-construct.ts [64:105]


  constructor(scope: Construct, id: string, props: IJumpbox) {
    super(scope, id);

    const stack = Stack.of(this);

    this.region = stack.region; // Returns the AWS::Region for this stack (or the literal value if known)

    //=========================================================================
    // Resource
    //=========================================================================
    /**
     * @description security group for jumpbox
     * @type {SecurityGroup}
     */
    const sg: SecurityGroup = new SecurityGroup(this, "JumpboxSG", {
      vpc: props.vpc,
      allowAllOutbound: false,
    });
    sg.addEgressRule(Peer.anyIpv4(), Port.tcp(80), "allow outbound https");
    sg.addEgressRule(Peer.anyIpv4(), Port.tcp(443), "allow outbound https");
    applyCfnNagSuppressRules(sg.node.defaultChild as CfnResource, [
      cfn_suppress_rules.W5,
    ]);
    (sg.node.defaultChild as CfnResource).cfnOptions.condition = props.deploy;

    /**
     * @description jumpbox instance
     * @type {Instance}
     */
    const jumpbox: Instance = new Instance(this, "JumpboxEC2", {
      vpc: props.vpc,
      instanceType: new InstanceType(manifest.jumpboxInstanceType),
      machineImage: MachineImage.latestWindows(
        WindowsVersion.WINDOWS_SERVER_2019_ENGLISH_FULL_BASE
      ),
      securityGroup: sg,
      vpcSubnets: { subnets: props.subnets },
      keyName: props.keyname,
    });
    (jumpbox.node.defaultChild as CfnResource).cfnOptions.condition =
      props.deploy;
  }