23.06.2023 Views

AWS

4 weeks subscription

4 weeks subscription

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Amazon Simple Queue Service Developer Guide<br />

Basic Use Cases for Access Control<br />

}<br />

]<br />

}<br />

}<br />

"DateLessThan" : {<br />

"<strong>AWS</strong>:CurrentTime":"2009-06-30T12:00Z"<br />

}<br />

Use Case 3<br />

In this use case, you want to allow access to your queues only if the requests come from your Amazon<br />

EC2 instances.<br />

Again, you need to know how to write your own policy because the SQS AddPermission action doesn't<br />

let you specify an IP address restriction when granting access to your queue.<br />

The following example builds on the example in use case 2, and also includes a condition that restricts<br />

access to the IP address range 10.52.176.0/24. So in this example, a request from <strong>AWS</strong> account<br />

1234-5678-9012 to send or receive messages from queue2 would be allowed only if it came in before<br />

noon on June 30, 2009, and it came from the 10.52.176.0/24 address range.<br />

{<br />

}<br />

"Version":"2008-10-17",<br />

"Id":"UseCase3",<br />

"Statement" : [<br />

{<br />

"Sid":"1",<br />

"Effect":"Allow",<br />

"Principal" : {<br />

"<strong>AWS</strong>": "123456789012"<br />

},<br />

"Action":["sqs:SendMessage","sqs:ReceiveMessage"],<br />

"Resource": "/987654321000/queue2",<br />

"Condition" : {<br />

"DateLessThan" : {<br />

"<strong>AWS</strong>:CurrentTime":"2009-06-30T12:00Z"<br />

},<br />

"IpAddress" : {<br />

"<strong>AWS</strong>:SourceIp":"10.52.176.0/24"<br />

}<br />

}<br />

}<br />

]<br />

Use Case 4<br />

In this use case, you want to specifically deny a certain <strong>AWS</strong> account access to your queues.<br />

Again, you need to know how to write your own policy because the SQS AddPermission action doesn't<br />

let you deny access to a queue; it only lets you grant access.<br />

The following example is the same as in the original use case (#1), except it denies access to the specified<br />

<strong>AWS</strong> account.<br />

API Version 2009-02-01<br />

44

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!