title: Error Code: AuthorizationError in AmazonSNS
body: <p>Im trying to create a SNS topic and publish messages from the lambda. But im getting authorization error when trying to do that. </p>
  
  <pre><code>Service: AmazonSNS; Status Code: 403; Error Code: AuthorizationError
  </code></pre>
  
  <p>Full exception</p>
  
  <pre><code>com.amazonaws.services.sns.model.AuthorizationErrorException: User: arn:aws:sts::166916908689:assumed-role/AWSLambdaVPCAccessExecutionRole/lambda-event-common-test is not authorized to perform: SNS:Publish on resource: arn:aws:sns:eu-west-1:166916908689:events (Service: AmazonSNS; Status Code: 403; Error Code: AuthorizationError; Request ID: 9266e536-baa4-55d1-b277-b766f5536b70)
  </code></pre>
  
  <p>my sam template looks like this</p>
  
  <pre><code>AWSTemplateFormatVersion: '2010-09-09'
  Transform: AWS::Serverless-2016-10-31
  Resources:
    EventListenFunction:
      Type: AWS::Serverless::Function
      Properties:
        Handler: event.lambda.EventHandler::handleRequest
        Role: !Sub arn:aws:iam::${AWS::AccountId}:role/AWSLambdaVPCAccessExecutionRole
        FunctionName: lambda-event-$ENVNAME
        Runtime: java8
        VpcConfig:
          SecurityGroupIds:
            - !ImportValue LambdaVPCSecurityGroup
          SubnetIds:
            - !ImportValue VsolPublicSubnetAz1
            - !ImportValue VsolPublicSubnetAz2
        Environment:
          Variables:
            SNS_TOPIC_ARN: !Ref Topic
        Events:
          GetResource:
            Type: Api
            Properties:
              Path: /event/{Id}
              Method: post
        Policies:
          Statement:
            - Effect: Allow
              Action: sns:Publish
              Resource: !Ref Topic
    Topic:
        Type: "AWS::SNS::Topic"
        Properties:
          DisplayName: "events"
          TopicName: "events"  
  </code></pre>
  
  <p>Sending sns notification</p>
  
  <pre><code>private AmazonSNSClient snsClient =(AmazonSNSClient)AmazonSNSClient.builder().build();
   snsClient.publish(new PublishRequest(System.getenv(“SNS_TOPIC_ARN
  ”),”Test”));
  </code></pre>
  
  <p>Its possible to allow any user to publish for sns topic using the console. Im looking a way to do it using the sam template.</p>
  
  <p>Thanks</p>