Question

I am publishing a message to and AWS SNS topic from a Rails 3 application using the AWS SDK for Ruby as below:

sns = AWS::SNS.new
topic = sns.topics['arn:aws:sns:eu-west-1:55555555555:my_topic']
topic.publish("MESSAGE", :subject => "SUBJECT")

When I publish to a topic in "us-east-1" it works as expected, but publishing to a topic in region "eu-west-1" does not work throwing:

AWS::SNS::Errors::InvalidParameter - Invalid parameter: TopicArn:

With the AWS SDK for Java set the region when creating the client object. Is there a similar way to set the region with the AWS SDK for Ruby?

Était-ce utile?

La solution

Yes, in your AWS config which you can either pass in with your config intializer script

:region => 'eu-west-1'

Or create it in a file with your accesskey etc and pass the whole file in when newing up your api client

sns = AWS::SNS.new configFile
Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top