How to use the @aws-cdk/aws-cloudformation.CfnStack function in @aws-cdk/aws-cloudformation

To help you get started, we’ve selected a few @aws-cdk/aws-cloudformation examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-cdk / examples / cdk-examples-typescript / advanced-usage / index.ts View on Github external
constructor(scope: cdk.App, id: string, props?: cdk.StackProps) {
    super(scope, id, props);

    // pick up to 3 AZs from environment.
    const azs = new cdk.AvailabilityZoneProvider(this).availabilityZones.slice(0, 3);

    // add an "AWS::CloudFormation::Stack" resource which uses the MongoDB quickstart
    // https://aws.amazon.com/quickstart/architecture/mongodb/
    // only non-default values are provided here.
    new CfnStack(this, 'NestedStack', {
      templateUrl: 'https://s3.amazonaws.com/quickstart-reference/mongodb/latest/templates/mongodb-master.template',
      parameters: {
        KeyPairName: 'my-key-pair',
        RemoteAccessCIDR: '0.0.0.0/0',
        AvailabilityZones: azs.join(','),
        NumberOfAZs: azs.length.toString(),
        MongoDBAdminPassword: 'root1234',
      }
    });
  }
}
github aws / aws-cdk / packages / @aws-cdk / aws-quickstarts / lib / rdgw.ts View on Github external
const params: any = {
      RDGWCIDR: props.rdgwCIDR,
      VPCID: props.vpc.vpcId,
      PublicSubnet1ID: props.vpc.publicSubnets[0].subnetId,
      PublicSubnet2ID: props.vpc.publicSubnets[1].subnetId,
      AdminPassword: props.adminPassword,
      AdminUser: props.adminUser,
      DomainDNSName: props.domainDNSName,
      KeyPairName: props.keyPairName,
      NumberOfRDGWHosts: props.numberOfRDGWHosts,
      QSS3BucketName: props.qss3BucketName,
      QSS3KeyPrefix: props.qss3KeyPrefix,
      RDGWInstanceType: props.rdgwInstanceType,
    };

    const nestedStack = new CfnStack(this, 'Resource', {
      templateUrl: 'https://s3.amazonaws.com/quickstart-reference/microsoft/rdgateway/latest/templates/rdgw-standalone.template',
      parameters: params
    });

    const securityGroup = ec2.SecurityGroup.fromSecurityGroupId(this, 'SecurityGroup',
      nestedStack.getAtt('Outputs.RemoteDesktopGatewaySGID').toString());

    const defaultPortRange = new ec2.TcpPort(RemoteDesktopGateway.PORT);
    this.connections = new ec2.Connections({ securityGroups: [securityGroup], defaultPortRange });
  }
}