Boto3 SNS Publish to a wildcard Topic ARN
<p><strong>Background</strong></p>

<p>AWS services are regional (e.g. <code>us-west-2</code>, <code>us-east-1</code>) and the <strong>boto3</strong> library requires you to set a default region before accessing the Client or Resources. However, the documentation <a href="http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html" rel="nofollow">here</a> shows that you can have an SNS Topic ARN with a wildcard substituted for the region. The documentation says:</p>

<p><strong>Documentation: Amazon Simple Notification Service (Amazon SNS)</strong></p>

<p>Syntax:</p>

<pre><code>arn:aws:sns:region:account-id:topicname
arn:aws:sns:region:account-id:topicname:subscriptionid
</code></pre>

<p>Examples:</p>

<pre><code>arn:aws:sns:*:123456789012:my_corporate_topic
arn:aws:sns:us-east-1:123456789012:my_corporate_topic:02034b43-fefa-4e07-a5eb-3be56f8c54ce
</code></pre>

<p><strong>Code</strong></p>

<p>When I use boto3's SNS Resource/Client to Publish to a Topic ARN (that has a wildcard for the region), I get the below error. When I don't have the wildcard for the region (e.g. I specify <code>us-west-2</code>), everything works. I looked into the boto3 library and it seems to just replace values in a JSON mapping (e.g. inserts Topic string) so I don't understand why this would be an invalid parameter if the documentation above shows that it's valid.</p>

<pre><code>import boto3

client = boto3.client('sns', region_name='us-west-2')
client.publish(TopicArn='arn:aws:sns:*:123456789:some-topic', Message='SomeMessage')
</code></pre>

<p><strong>Error Message</strong></p>

<pre><code>File "/Users/wliu/.virtualenvs/myenv/lib/python2.7/site-packages/botocore/client.py", line 548, in _make_api_call
raise ClientError(parsed_response, operation_name)
ClientError: An error occurred (InvalidParameter) when calling the Publish operation: Invalid parameter: TopicArn Reason: A * ARN must begin with arn:null, not arn:aws:sns:*:123456789:my_topic
</code></pre>