How to use @aws-cdk/region-info - 5 common examples

To help you get started, we’ve selected a few @aws-cdk/region-info 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 / packages / aws-cdk / lib / api / cxapp / stacks.ts View on Github external
// Cache the new context to disk
          await this.props.configuration.saveContext();

          // Execute again
          continue;
        }
      }

      if (trackVersions && assembly.runtime) {
        const modules = formatModules(assembly.runtime);
        for (const stack of assembly.stacks) {
          if (!stack.template.Resources) {
            stack.template.Resources = {};
          }
          const resourcePresent = stack.environment.region === cxapi.UNKNOWN_REGION
            || RegionInfo.get(stack.environment.region).cdkMetadataResourceAvailable;
          if (resourcePresent) {
            if (!stack.template.Resources.CDKMetadata) {
              stack.template.Resources.CDKMetadata = {
                Type: 'AWS::CDK::Metadata',
                Properties: {
                  Modules: modules
                }
              };
              if (stack.environment.region === cxapi.UNKNOWN_REGION) {
                stack.template.Conditions = stack.template.Conditions || {};
                const condName = 'CDKMetadataAvailable';
                if (!stack.template.Conditions[condName]) {
                  stack.template.Conditions[condName] = _makeCdkMetadataAvailableCondition();
                  stack.template.Resources.CDKMetadata.Condition = condName;
                } else {
                  warning(`The stack ${stack.id} already includes a ${condName} condition`);
github aws / aws-cdk / packages / @aws-cdk / aws-iam / lib / principals.ts View on Github external
public resolve(ctx: cdk.IResolveContext) {
    const region = this.opts.region || cdk.Stack.of(ctx.scope).region;
    const fact = RegionInfo.get(region).servicePrincipal(this.service);
    return fact || Default.servicePrincipal(this.service, region, cdk.Aws.URL_SUFFIX);
  }
github aws / aws-cdk / packages / @aws-cdk / aws-route53-targets / lib / bucket-website-target.ts View on Github external
public bind(_record: route53.IRecordSet): route53.AliasRecordTargetConfig {
    const {region} = Stack.of(this.bucket.stack);

    if (Token.isUnresolved(region)) {
      throw new Error([
        'Cannot use an S3 record alias in region-agnostic stacks.',
        'You must specify a specific region when you define the stack',
        '(see https://docs.aws.amazon.com/cdk/latest/guide/environments.html)'
      ].join(' '));
    }

    const {s3StaticWebsiteHostedZoneId: hostedZoneId, s3StaticWebsiteEndpoint: dnsName} = RegionInfo.get(region);

    if (!hostedZoneId || !dnsName) {
      throw new Error(`Bucket website target is not supported for the "${region}" region`);
    }

    return {hostedZoneId, dnsName};
  }
}
github aws / aws-cdk / packages / @aws-cdk / aws-iam / lib / principals.ts View on Github external
public resolve(ctx: cdk.IResolveContext) {
    const region = this.opts.region || cdk.Stack.of(ctx.scope).region;
    const fact = RegionInfo.get(region).servicePrincipal(this.service);
    return fact || Default.servicePrincipal(this.service, region, cdk.Aws.URL_SUFFIX);
  }
github aws / aws-cdk / packages / aws-cdk / lib / api / cxapp / stacks.ts View on Github external
function _makeCdkMetadataAvailableCondition() {
  return _fnOr(RegionInfo.regions
    .filter(ri => ri.cdkMetadataResourceAvailable)
    .map(ri => ({ 'Fn::Equals': [{ Ref: 'AWS::Region' }, ri.name] })));
}

@aws-cdk/region-info

AWS region information, such as service principal names

Apache-2.0
Latest version published 4 days ago

Package Health Score

98 / 100
Full package analysis