diff --git a/src/aws/sns/createSnsTopic.ts b/src/aws/sns/createSnsTopic.ts index ec40651..19ee483 100644 --- a/src/aws/sns/createSnsTopic.ts +++ b/src/aws/sns/createSnsTopic.ts @@ -1,7 +1,7 @@ import AWS from 'aws-sdk'; -export default async (topicName: string) => { - const sns = new AWS.SNS(); +export default async (topicName: string, region = 'us-east-1') => { + const sns = new AWS.SNS({ region }); const params = { Name: topicName, diff --git a/src/aws/sns/publishSnsMessage.ts b/src/aws/sns/publishSnsMessage.ts index 943811e..444c128 100644 --- a/src/aws/sns/publishSnsMessage.ts +++ b/src/aws/sns/publishSnsMessage.ts @@ -1,7 +1,11 @@ import AWS from 'aws-sdk'; -export default async (topicName: string, message: string) => { - const sns = new AWS.SNS(); +export default async ( + topicName: string, + message: string, + region = 'us-east-1', +) => { + const sns = new AWS.SNS({ region }); const listTopicsResponse = await sns.listTopics().promise(); diff --git a/src/aws/sns/removeSnsTopic.ts b/src/aws/sns/removeSnsTopic.ts index c8eedf0..c3fe777 100644 --- a/src/aws/sns/removeSnsTopic.ts +++ b/src/aws/sns/removeSnsTopic.ts @@ -1,7 +1,7 @@ import AWS from 'aws-sdk'; -export default async (topicName: string) => { - const sns = new AWS.SNS(); +export default async (topicName: string, region = 'us-east-1') => { + const sns = new AWS.SNS({ region }); const listTopicsResponse = await sns.listTopics().promise(); if (!listTopicsResponse || !listTopicsResponse.Topics) {