SQSPolicy Fails during stack creation

Asked by At

I can't seem to figure out what is causing this failure. I referred to one article. Can anyone tell me what may be causing this error?

AllowSNS2SQSPolicy:
    Type: AWS::SQS::QueuePolicy
    Properties:
      Queues: [ !Ref SQSQueue ]
      PolicyDocument:
        Version: "2012-10-17"
        Id: SQSPolicy
        Statement: 
        - Sid: Allow-SNS-SendMessage    
          Effect: Allow 
          Principal:    
            AWS:
            - 'arn:aws:ecs:${AWS::Region}:${AWS::AccountId:}:cluster/foo'
          Action:   
          - 'sqs:SendMessage'
          - 'sqs:ReceiveMessage' 
          Resource: !GetAtt [SQSQueue, Arn]

Error Message:

Invalid value for parameter Policy. (Service: AmazonSQS; Status Code: 400, Error Code: InvalidAttributeValue...

1 Answers

1
Hassan Mussana On

This should solve it:

AllowSNS2SQSPolicy:
  Type: AWS::SQS::QueuePolicy
  Properties:
    Queues: [ !Ref SQSQueue ]
    PolicyDocument:
      Version: "2012-10-17"
      Id: SQSPolicy
      Statement: 
      - Sid: Allow-SNS-SendMessage    
        Effect: Allow 
        Principal:    
          AWS:'arn:aws:ecs:${AWS::Region}:${AWS::AccountId:}:cluster/foo'
        Action:   
        - 'sqs:SendMessage'
        - 'sqs:ReceiveMessage' 
        Resource: !GetAtt [SQSQueue, Arn]