Skip navigation links

Package com.amazonaws.auth.policy

Classes for creating custom AWS access control policies.

See: Description

Package com.amazonaws.auth.policy Description

Classes for creating custom AWS access control policies. Policies allow you to specify fine grained access controls on your AWS resources. You can allow or deny access to your AWS resources based on:

Access control policies are a collection of statements. Each statement takes the form: "A has permission to do B to C where D applies".

The following code creates a policy to allow a specific AWS account to send and receive messages using one of your Amazon SQS queues:

    Policy policy = new Policy("MyQueuePolicy");
    policy.withStatements(new Statement(Effect.Allow)
           .withPrincipals(new Principal("123456789012"))
           .withActions(SQSActions.SendMessage, SQSActions.ReceiveMessage)
           .withResources(new SQSQueueResource("987654321000", "queue2")));
 

Once you've created a policy, you need to use methods on the service to upload your policy to AWS.

Skip navigation links

Copyright © 2022. All rights reserved.