문제

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?

도움이 되었습니까?

해결책

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
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top