Socket
Socket
Sign inDemoInstall

@aws-cdk/region-info

Package Overview
Dependencies
Maintainers
5
Versions
513
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@aws-cdk/region-info

AWS region information, such as service principal names


Version published
Weekly downloads
236K
increased by19.6%
Maintainers
5
Weekly downloads
 
Created

Package description

What is @aws-cdk/region-info?

@aws-cdk/region-info is an AWS CDK library that provides information about AWS regions and services. It allows developers to programmatically access details about AWS regions, such as the services available in each region, region names, and partition information.

What are @aws-cdk/region-info's main functionalities?

Get Region Information

This feature allows you to get information about a specific AWS region. In this example, it retrieves the name of the 'us-east-1' region.

const regionInfo = require('@aws-cdk/region-info');
const region = regionInfo.RegionInfo.get('us-east-1');
console.log(region.name); // Output: US East (N. Virginia)

Check if a Service is Available in a Region

This feature allows you to check if a specific AWS service is available in a given region. In this example, it checks if the S3 service is available in the 'us-east-1' region.

const regionInfo = require('@aws-cdk/region-info');
const region = regionInfo.RegionInfo.get('us-east-1');
const isAvailable = region.servicePrincipal('s3') !== undefined;
console.log(isAvailable); // Output: true

Get Partition Information

This feature allows you to get the partition information for a specific region. In this example, it retrieves the partition for the 'us-east-1' region, which is 'aws'.

const regionInfo = require('@aws-cdk/region-info');
const partition = regionInfo.RegionInfo.get('us-east-1').partition;
console.log(partition); // Output: aws

Other packages similar to @aws-cdk/region-info

Changelog

Source

1.135.0 (2021-12-10)

⚠ BREAKING CHANGES TO EXPERIMENTAL FEATURES

  • apigatewayv2-authorizers: The default value for the prop authorizerName in HttpJwtAuthorizerProps has changed.
  • apigatewayv2-authorizers: HttpJwtAuthorizer now takes the construct id and the target jwt issuer as part of its constructor.
  • apigatewayv2-authorizers: HttpLambdaAuthorizer now takes the construct id and the target lambda function handler as part of its constructor.
  • apigatewayv2-authorizers: The default value for the prop authorizerName in HttpUserPoolAuthorizerProps has changed.
  • apigatewayv2: The HttpIntegration and WebSocketIntegration classes require an "id" parameter to be provided during its initialization.
  • apigatewayv2-integrations: The LambdaWebSocketIntegration is now renamed to WebSocketLambdaIntegration. The new class accepts the handler to the target lambda function directly in its constructor.
  • apigatewayv2-integrations: HttpProxyIntegration and HttpProxyIntegrationProps are now renamed to HttpUrlIntegration and HttpUrlIntegrationProps respectively. The new class accepts the target url directly in its constructor.
  • apigatewayv2-integrations: LambdaProxyIntegration and LambdaProxyIntegrationProps are now renamed to HttpLambdaIntegration and HttpLambdaIntegrationProps respectively. The new class accepts the lambda function handler directly in its constructor.
  • apigatewayv2-integrations: HttpAlbIntegration now accepts the ELB listener directly in its constructor.
  • apigatewayv2-integrations: HttpNlbIntegration now accepts the ELB listener directly in its constructor.
  • apigatewayv2-integrations: HttpServiceDiscoveryIntegration now accepts the service discovery Service directly in its constructor.
  • apigatewayv2-authorizers: UserPoolAuthorizerProps is now renamed to HttpUserPoolAuthorizerProps.
  • apigatewayv2: The interface IHttpRouteIntegration is replaced by the abstract class HttpRouteIntegration.
  • apigatewayv2: The interface IWebSocketRouteIntegration is now replaced by the abstract class WebSocketRouteIntegration.
  • apigatewayv2: Previously, we allowed the usage of integration classes to be used with routes defined in multiple HttpApi instances (or WebSocketApi instances). This is now disallowed, and separate instances must be created for each instance of HttpApi or WebSocketApi.

Features

Bug Fixes

  • apigateway: dataTraceEnabled does not default to false (#17906) (cc3bb1f)
  • apigatewayv2: integration class does not render an integration resource (#17729) (3b5b97a), closes #13213
  • apprunner: startCommand and environment are ignored in imageConfiguration (#16939) (d911c58), closes #16812
  • appsync: add caching config to AppSync resolvers (#17815) (52b535b)
  • appsync: empty caching config is created when not provided (#17947) (3a9f206)
  • appsync: remove 'id' suffix to union definition key (#17787) (86e7780), closes #17771
  • assert: support multiline strings with stringLike() (#17692) (37596e6)
  • assets: remove the original-path metadata (#17901) (2b759ca), closes #17706
  • aws-cdk-migration: Construct imports not rewritten (#17931) (f02fcb4), closes #17826
  • aws-ec2: imported VPC subnets never recognized as PRIVATE_ISOLATED (#17496) (ba6a8ef)
  • aws-elasticloadbalancingv2: Set stickiness.enabled unless target type is lambda (#17271) (168a98f), closes #17261
  • cli: S3 asset uploads are rejected by commonly referenced encryption SCP (introduces bootstrap stack v9) (#17668) (8191f1f), closes #11265
  • codepipeline: cannot trigger on all tags anymore in EcrSourceAction (#17270) (39fe11b), closes aws#13818 aws#13818
  • codepipeline: cross-env pipeline cannot be created in Stage (#17730) (f17f29e), closes #17643
  • codepipeline: default cross-region S3 buckets allow public access (#17722) (0b80db5), closes #16411
  • cognito: remove invalid SES region check (#17868) (450f7ca), closes #17795
  • core: bundling skipped with --exclusively option and stacks under stage (#17210) (cda6601), closes #12898 #15346
  • docdb: secret rotation ignores excluded characters in password (#17609) (1fe2215), closes #17347 #17575
  • dynamodb: add missing DynamoDB operations to enum (#17738) (f38e0ac)
  • dynamodb: changing waitForReplicationToFinish fails deployment (#17842) (36b8fdb), closes #16983
  • iam: AWS Managed Policy ARNs are not deduped (#17623) (ed4a4b4), closes #17552
  • lambda-nodejs: bundling fails with a file dependency in nodeModules (#17851) (5737c33), closes #17830
  • lambda-nodejs: bundling with nodeModules fails with paths containing spaces (#17632) (986f291), closes #17631
  • pipelines: stack outputs used in stackSteps not recognized (#17311) (5e4a219), closes #17272
  • s3-deployment: updating memoryLimit or vpc results in stack update failure (#17530) (2ba40d1), closes #7128
  • stepfunctions: prefixes not appended to states in parallel branches (#17806) (a1da772), closes #17354

Miscellaneous Chores

  • apigatewayv2: integration api re-organization (#17752) (29039e8)
  • apigatewayv2-authorizers: re-organize authorizer api (#17772) (719f33e)

Readme

Source

AWS Region-Specific Information Directory


cdk-constructs: Stable


Usage

Some information used in CDK Applications differs from one AWS region to another, such as service principals used in IAM policies, S3 static website endpoints, ...

The RegionInfo class

The library offers a simple interface to obtain region specific information in the form of the RegionInfo class. This is the preferred way to interact with the regional information database:

import { RegionInfo } from '@aws-cdk/region-info';

// Get the information for "eu-west-1":
const region = RegionInfo.get('eu-west-1');

// Access attributes:
region.s3StaticWebsiteEndpoint; // s3-website-eu-west-1.amazonaws.com
region.servicePrincipal('logs.amazonaws.com'); // logs.eu-west-1.amazonaws.com

The RegionInfo layer is built on top of the Low-Level API, which is described below and can be used to register additional data, including user-defined facts that are not available through the RegionInfo interface.

Low-Level API

This library offers a primitive database of such information so that CDK constructs can easily access regional information. The FactName class provides a list of known fact names, which can then be used with the RegionInfo to retrieve a particular value:

import * as regionInfo from '@aws-cdk/region-info';

const codeDeployPrincipal = regionInfo.Fact.find('us-east-1', regionInfo.FactName.servicePrincipal('codedeploy.amazonaws.com'));
// => codedeploy.us-east-1.amazonaws.com

const staticWebsite = regionInfo.Fact.find('ap-northeast-1', regionInfo.FactName.S3_STATIC_WEBSITE_ENDPOINT);
// => s3-website-ap-northeast-1.amazonaws.com

Supplying new or missing information

As new regions are released, it might happen that a particular fact you need is missing from the library. In such cases, the Fact.register method can be used to inject FactName into the database:

regionInfo.Fact.register({
  region: 'bermuda-triangle-1',
  name: regionInfo.FactName.servicePrincipal('s3.amazonaws.com'),
  value: 's3-website.bermuda-triangle-1.nowhere.com',
});

Overriding incorrect information

In the event information provided by the library is incorrect, it can be overridden using the same Fact.register method demonstrated above, simply adding an extra boolean argument:

regionInfo.Fact.register({
  region: 'us-east-1',
  name: regionInfo.FactName.servicePrincipal('service.amazonaws.com'),
  value: 'the-correct-principal.amazonaws.com',
}, true /* Allow overriding information */);

If you happen to have stumbled upon incorrect data built into this library, it is always a good idea to report your findings in a GitHub issue, so we can fix it for everyone else!


This module is part of the AWS Cloud Development Kit project.

Keywords

FAQs

Package last updated on 10 Dec 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc