cdk-lex-zip-import
TypeScript icon, indicating that this package has built-in type declarations

0.0.90 • Public • Published

cdk-lex-zip-import

Experimental

An AWS Cloud Development Kit (AWS CDK) construct library that allows you to upload and deploy a Zipped Lex Bot. Once imported, this Bot can be managed within the Amazon Lex Console.

Usage

To add to your AWS CDK package.json file:

yarn add cdk-lex-zip-import

Within your AWS CDK:

Import Lex Bot

const bot = new lexupload.ImportBot(this, 'lexBot', {
  sourceDirectory: './resources/LexBot',
  lexRoleArn: lexRole.roleArn,
});

The sourceDirecotry must include a file named LexBot.zip. All files in that directory will be uploaded, but only a file named LexBot.zip will be imported to Lex as a Bot.

The lexRoleArn refers to the roleArn of an IAM Role. For example:

const lexRole = new iam.Role(this, 'lexRole', {
  assumedBy: new iam.ServicePrincipal('lex.amazonaws.com'),
  inlinePolicies: {
    ['lexPolicy']: new iam.PolicyDocument({
      statements: [
        new iam.PolicyStatement({
          resources: ['*'],
          actions: ['polly:SynthesizeSpeech', 'comprehend:DetectSentiment'],
        }),
      ],
    }),
  },
});

Adding a Resource Policy

bot.addResourcePolicy(resourceArn, policy);

addResourcePolicy requires two properties: the resourceArn of the Lex Bot, and a policy to be applied. This policy will be applied to the alias associated with the Bot.

Resource ARN Example:

const resourceArn = `arn:aws:lex:${this.region}:${this.account}:bot-alias/${bot.botId}/${bot.botAliasId}`;

Policy Example:

const policy = {
  Version: '2012-10-17',
  Statement: [
    {
      Sid: 'AllowChimePstnAudioUseBot',
      Effect: 'Allow',
      Principal: { Service: 'voiceconnector.chime.amazonaws.com' },
      Action: 'lex:StartConversation',
      Resource: resourceArn,
      Condition: {
        StringEquals: { 'AWS:SourceAccount': `${this.account}` },
        ArnEquals: {
          'AWS:SourceArn': `arn:aws:voiceconnector:us-east-1:${this.account}:*`,
        },
      },
    },
  ],
};

Not Supported Yet

This is a work in progress.

Features that are not supported yet:

  • [ ] Non-Draft Versions
  • [ ] Updates to created resources

Contributing

See CONTRIBUTING for more information.

License

This project is licensed under the Apache-2.0 License.

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
0.0.902latest

Version History

VersionDownloads (Last 7 Days)Published
0.0.902
0.0.890
0.0.880
0.0.870
0.0.860
0.0.850
0.0.840
0.0.830
0.0.820
0.0.810
0.0.800
0.0.790
0.0.780
0.0.770
0.0.760
0.0.750
0.0.740
0.0.730
0.0.720
0.0.710
0.0.700
0.0.690
0.0.680
0.0.670
0.0.661
0.0.650
0.0.640
0.0.630
0.0.620
0.0.611
0.0.600
0.0.590
0.0.580
0.0.570
0.0.560
0.0.550
0.0.540
0.0.530
0.0.520
0.0.510
0.0.501
0.0.490
0.0.480
0.0.471
0.0.460
0.0.450
0.0.440
0.0.430
0.0.420
0.0.410
0.0.400
0.0.390
0.0.380
0.0.370
0.0.361
0.0.350
0.0.340
0.0.331
0.0.320
0.0.311
0.0.300
0.0.290
0.0.280
0.0.270
0.0.260
0.0.250
0.0.240
0.0.230
0.0.220
0.0.210
0.0.200
0.0.190
0.0.180
0.0.170
0.0.160
0.0.150
0.0.140
0.0.130
0.0.120
0.0.110
0.0.100
0.0.90
0.0.80
0.0.70
0.0.60
0.0.50
0.0.40
0.0.30

Package Sidebar

Install

npm i cdk-lex-zip-import

Weekly Downloads

9

Version

0.0.90

License

Apache-2.0

Unpacked Size

657 kB

Total Files

23

Last publish

Collaborators

  • schuettc