infrastructure-stack.ts 789 B

123456789101112131415161718192021
  1. import * as cdk from '@aws-cdk/core';
  2. import * as sns from '@aws-cdk/aws-sns';
  3. import * as sqs from '@aws-cdk/aws-sqs';
  4. import * as subs from '@aws-cdk/aws-sns-subscriptions';
  5. export class InfrastructureStack extends cdk.Stack {
  6. constructor(scope: cdk.Construct, id: string, props?: cdk.StackProps) {
  7. super(scope, id, props);
  8. const topic = new sns.Topic(this, 'snsSpring', {
  9. displayName: 'Spring cloud AWS SNS sample',
  10. topicName: 'snsSpring',
  11. });
  12. const queue = new sqs.Queue(this, 'spring-aws', { queueName: `${id}-spring-aws` });
  13. topic.addSubscription(new subs.SqsSubscription(queue));
  14. //URL from NGROK goes here
  15. topic.addSubscription(new subs.UrlSubscription('https://5d50-2a02-8109-8380-c8c-d911-1af7-8ab6-35e1.ngrok.io/testTopic'));
  16. }
  17. }