Search code examples
amazon-web-servicesaws-lambdaaws-cliamazon-sqs

How to grant an aws lambda permission to send messages to a specific SQS using AWS CLI?


I want to grant a lambda permission to access a specific queue using the AWS cli so i am able to send messages to that queue from the lambda.

So for example if i want to add sqs:SendMessage to a lambda so it can send messages to a queue resource using the AWS CLI, what is the command to do that?


Solution

  • you may have to add an IAM policy to your lambda role. the policy can be something like below.

    {
        "Version": "2012-10-17",
        "Statement": [
            {
                "Effect": "Allow",
                "Action": [
                    "sqs:SendMessage"
                ],
                "Resource": "*"
            }
        ]
    }
    

    add the ARN of your SQS resource in Resource Property.