Skip to main content

cdk-amazon-chime-resources

Project description

cdk-amazon-chime-resources

Experimental

An AWS Cloud Development Kit (AWS CDK) construct library that allows you to provision Amazon Chime resources with npm and pypi

Background

Amazon Chime resources (Phone numbers, SIP media applications, and Voice Connectors) are not natively available in AWS CloudFormation or AWS CDK. Therefore, in order to create these resources with AWS CDK, an AWS Lambda backed custom resource must be used. In an effort to simplify that process, this AWS CDK construct has been created. This AWS CDK construct will create a custom resource and associated Lambda and expose constructs that can be used to create corresponding resources.

Usage

See example/lib/cdk-chime-resources-example.ts for a complete example.

To add to your AWS CDK package.json file:

yarn add cdk-amazon-chime-resources

Within your AWS CDK:

Phone Number Creation

const phoneNumber = new chime.ChimePhoneNumber(this, 'phoneNumber', {
  phoneState: 'IL',
  phoneNumberType: chime.PhoneNumberType.LOCAL,
  phoneProductType: chime.PhoneProductType.SMA,
});

The phone number created will be a LOCAL number for use with SMA from a pool of available numbers in Illinois. Other search option are available that will return a single phone number based on the criteria provided.

SIP Media Application Creation

const sipMediaApp = new chime.ChimeSipMediaApp(this, 'sipMediaApp', {
  region: this.region,
  endpoint: smaHandler.functionArn,
});

The SIP media application created will use the smaHandler referenced by the endpoint in the same region the AWS CDK is being deployed in. The SIP media application must be created in the same region as the associated Lambda endpoint and must be in us-east-1 or us-west-2.

SIP Media Application Rule Creation

const sipRule = new chime.ChimeSipRule(this, 'sipRule', {
  triggerType: chime.TriggerType.TO_PHONE_NUMBER,
  triggerValue: phoneNumber.phoneNumber,
  targetApplications: [
    {
      region: this.region,
      priority: 1,
      sipMediaApplicationId: sipMediaApp.sipMediaAppId,
    },
  ],
});

The SIP rule will assocaite the previously created phone number with the previously created SIP media application. The SIP rule can be associated with either an E.164 number or Amazon Chime Voice Connector URI. If the TriggerType is TO_PHONE_NUMBER, the TriggerValue must be an E.164 number. If the TriggerType is REQUEST_URI_HOSTNAME, the TriggerValue must be an Amazon Chime Voice Connector URI. A priority must be assigned with a value between 1 and 25 inclusive. A targetApplication is required. This will associate the trigger to the SIP media application and associated Lambda.

Voice Connector Creation

Using a phone number created with Product Type of VC:

const voiceConnector = new chime.ChimeVoiceConnector(this, 'voiceConnector', {
  encryption: true,
  name: 'string',
  region: 'us-east-1',
  termination: {
    terminationCidrs: ['198.51.100.10/32'],
    callingRegions: ['US'],
  },
  origination: [
    {
      host: '198.51.100.10',
      port: 5061,
      protocol: chime.Protocol.TCP,
      priority: 1,
      weight: 1,
    },
  ],
  streaming: {
    enabled: true,
    dataRetention: 0,
    notificationTargets: [chime.NotificationTargetType.EVENTBRIDGE],
  },
});

This will create an Amazon Chime Voice Connector with specified options. Termination, origination, and streaming are all optional.

voiceConnectorPhone.associateWithVoiceConnector(voiceConnector);

This will assocaite the previously created phone number with the voice connector.

Not Supported Yet

This is a work in progress.

Features that are not supported yet:

  • Amazon Chime Voice Connector Groups
  • Amazon Chime Voice Connector Logging
  • Amazon Chime Voice Connector Emergency Calling
  • Updates to created resources

Contributing

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cdk-amazon-chime-resources-0.0.54.tar.gz (136.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cdk_amazon_chime_resources-0.0.54-py3-none-any.whl (135.2 kB view details)

Uploaded Python 3

File details

Details for the file cdk-amazon-chime-resources-0.0.54.tar.gz.

File metadata

  • Download URL: cdk-amazon-chime-resources-0.0.54.tar.gz
  • Upload date:
  • Size: 136.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for cdk-amazon-chime-resources-0.0.54.tar.gz
Algorithm Hash digest
SHA256 3cd2811dab120a9999da786e814fe5528f27c420e0b445ff5941997585b8eaa0
MD5 f8ac4212dbac31a0a622d68ec14fcd46
BLAKE2b-256 26f331be6fde7582ce321185b9c53117495f749ad7c1b8d4e6d90dd1ee8bb169

See more details on using hashes here.

File details

Details for the file cdk_amazon_chime_resources-0.0.54-py3-none-any.whl.

File metadata

  • Download URL: cdk_amazon_chime_resources-0.0.54-py3-none-any.whl
  • Upload date:
  • Size: 135.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.1 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.10.2

File hashes

Hashes for cdk_amazon_chime_resources-0.0.54-py3-none-any.whl
Algorithm Hash digest
SHA256 cc41625459578b699ed7541c1014d31738b0d0a9b746a0e4fc59c43a375d4d41
MD5 8bc6d99570ba00ea7343895508de9e48
BLAKE2b-256 834fae71153faafe0bbc245edd73200d00bd76c98879d4101134c0e7788b6690

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page