MatejNedic 8a605b665d Verify SNS messages in HTTP subscription mode (#240) 2 年之前
..
bin 8a605b665d Verify SNS messages in HTTP subscription mode (#240) 2 年之前
lib 8a605b665d Verify SNS messages in HTTP subscription mode (#240) 2 年之前
.gitignore c940b987e6 Add SNS sample (#25) 3 年之前
.npmignore c940b987e6 Add SNS sample (#25) 3 年之前
README.md c940b987e6 Add SNS sample (#25) 3 年之前
cdk.json c940b987e6 Add SNS sample (#25) 3 年之前
jest.config.js c940b987e6 Add SNS sample (#25) 3 年之前
package.json 8a605b665d Verify SNS messages in HTTP subscription mode (#240) 2 年之前
tsconfig.json c940b987e6 Add SNS sample (#25) 3 年之前

README.md

Spring Cloud AWS SNS Sample App Infrastructure

This sample shows sending SNS messages receiving them with SQSListener and NotificationMapping. To use NotificationMapping you will need to use NGROK: https://ngrok.com/docs Firstly you will need to start 'ngrok http 127.0.0.1:{YourPort}' after that you will need to change URL inside CDK. After you change URL inside CDK, you can run CDK deploy. Subscription will be automatically sent to NGROK url + topicTest. There is possibility subscription isn't confirmed since application is not started as of CDK deploy, so you should resend subscription from an AWS console. When you open AWS Management console from your favourite browser you search for SNS and after that on left side select subscriptions and request confirmation for NGROK url + /topicTest.

After that you can send messages in AWS console and see logged messages and subjects inside controller.

Infrastructure code to run Spring Cloud AWS SNS Sample App based on AWS CDK

How to install

  • npm install

How to run

  • cdk synth
  • cdk deploy

Once you don't need the infrastructure anymore, it can be destroyed by calling:

  • cdk destroy.

You will need following policies to run cdk and Sample app:

(Ideally this should be two different policies. One just for SNS and another for cloudFormations. For sake of sample and simplicity we will use one.)

{

"Version": "2012-10-17",
"Statement": [
    {
        "Effect": "Allow",
        "Action": [
            "sqs:DeleteMessage",
            "sqs:GetQueueUrl",
            "sqs:ReceiveMessage",
            "sqs:SendMessage",
            "sqs:GetQueueAttributes",
            "sqs:SetQueueAttributes"
            "sqs:DeleteQueue",
            "sqs:CreateQueue",
            "sns:ListTopics",
            "sns:GetTopicAttributes",
            "sns:DeleteTopic",
            "sns:CreateTopic",
            "sns:Publish",
            "sns:ConfirmSubscription",
            "cloudformation:CreateChangeSet",
            "cloudformation:DescribeStacks",
            "cloudformation:DescribeStackEvents",
            "cloudformation:GetTemplate",
            "cloudformation:DeleteStack",
            "cloudformation:DescribeChangeSet",
            "cloudformation:ExecuteChangeSet",
        ],
        "Resource": "arn"
    }
]

}