I have SNS topic SNS1 in region eu-west-1 and all other services SQS1 and are in eu-central-1 What I want is to subscribe my SQS to SNS topic trough a Serverless framework
My current serverless definition is
Resources:
SNS1:
Type: AWS::SNS::Topic
Properties:
TopicName: "SNS1"
SQS1:
Type: "AWS::SQS::Queue"
Properties:
QueueName: "SQS1"
snsSubscription:
Type: "AWS::SNS::Subscription"
Properties:
TopicArn: !Ref SNS1
Endpoint: !GetAtt
- SQS2
- Arn
Protocol: sqs
RawMessageDelivery: "true"
But this creates a new SNS topic in eu-central-1 (my default region) and I don't want that, is there some parameter to directly specify the SNS ARN? or specifying the region to the SNS?
I already try this configuration but it does not work
Resources:
SQS1:
Type: "AWS::SQS::Queue"
Properties:
QueueName: "SQS1"
snsSubscription:
Type: "AWS::SNS::Subscription"
Properties:
TopicArn: "arn:aws:sqs:eu-west-1:776751225653:SNS1"
Endpoint: !GetAtt
- SQS2
- Arn
Protocol: sqs
RawMessageDelivery: "true"
I get the error:
An error occurred: snsSubscription - Invalid parameter: TopicArn (Service: AmazonSNS; Status Code: 400; Error Code: InvalidParameter; Request ID: 9494047a-f933-5ece-9af8-5cfbf94a78a4; Proxy: null).
Note that the names are made-up I don't have numbers in the names of my resources