How to use the @aws-cdk/aws-sns.Topic.fromTopicArn function in @aws-cdk/aws-sns

To help you get started, we’ve selected a few @aws-cdk/aws-sns 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 daviddeejjames / send-that-invoice / lib / send-that-invoice-stack.ts View on Github external
environment: {
          DATA_BUCKET: `${bucket.bucketName}`,
          MAIL_NAME: `${mailName}`,
          MAIL_USER: `${mailUser}`,
          MAIL_PASS: `${mailPass}`,
          MAIL_HOST: `${mailHost}`,
          MAIL_PORT: `${mailPort}`,
          MAIL_REPLY_TO: `${mailReplyTo}`,
          DROPBOX_TOKEN: `${dropboxToken}`,
          SNS_TOPIC_ARN: `${snsTopicArn}`,
          SENTRY_DSN: `${sentryDsn}`
        }
      });

      bucket.grantReadWrite(lambdaFn);
      const snsTopic = Topic.fromTopicArn(
        this,
        'SendThatInvoice',
        `${snsTopicArn}`
      );
      snsTopic.grantPublish(lambdaFn);

      // Run every day at 6PM UTC
      // See https://docs.aws.amazon.com/lambda/latest/dg/tutorial-scheduled-events-schedule-expressions.html
      const rule = new events.Rule(this, 'send-that-invoice-cron-rule', {
        schedule: events.Schedule.expression('rate(4 hours)')
      });

      rule.addTarget(new targets.LambdaFunction(lambdaFn));
    } else {
      console.error(
        'It seems you haven\'t set one of your ENV vars correctly, please check below'

@aws-cdk/aws-sns

The CDK Construct Library for AWS::SNS

Apache-2.0
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis