A role is similar to a user and has permission policies attached to it, that determine what a role can or can not do. A role can be assumed by any identity that needs it. If a user assumes a role, a set of dynamically created temporary credentials are returned to the user. A role can be used to delegate access to users, applications, services that do not have permissions to access some s3 resources.
To modify a role's assume role policy document, execute the following::
radosgw-admin role modify --role-name={role-name} --assume-role-policy-doc={trust-policy-document}
Request Parameters
~~~~~~~~~~~~~~~~~~
``role-name``
:Description:Name of the role.
:Type:String
``assume-role-policy-doc``
:Description:The trust relationship policy document that grants an entity permission to assume the role.
:Type:String
For example::
radosgw-admin role modify --role-name=S3Access1 --assume-role-policy-doc=\{\"Version\":\"2012-10-17\",\"Statement\":\[\{\"Effect\":\"Allow\",\"Principal\":\{\"AWS\":\[\"arn:aws:iam:::user/TESTER2\"\]\},\"Action\":\[\"sts:AssumeRole\"\]\}\]\}
To delete permission policy attached to a role, execute the following::
radosgw-admin role policy rm --role-name={role-name} --policy-name={policy-name}
Request Parameters
~~~~~~~~~~~~~~~~~~
``role-name``
:Description:Name of the role.
:Type:String
``policy-name``
:Description:Name of the policy.
:Type:String
For example::
radosgw-admin role-policy get --role-name=S3Access1 --policy-name=Policy1
REST APIs for Manipulating a Role
=================================
In addition to the above radosgw-admin commands, the following REST APIs can be used for manipulating a role. For the request parameters and their explanations, refer to the sections above.
In order to invoke the REST admin APIs, a user with admin caps needs to be created.
POST "<hostname>?Action=CreateRole&RoleName=S3Access&Path=/application_abc/component_xyz/&AssumeRolePolicyDocument=\{\"Version\":\"2012-10-17\",\"Statement\":\[\{\"Effect\":\"Allow\",\"Principal\":\{\"AWS\":\[\"arn:aws:iam:::user/TESTER\"\]\},\"Action\":\[\"sts:AssumeRole\"\]\}\]\}"
POST "<hostname>?Action=UpdateAssumeRolePolicy&RoleName=S3Access&PolicyDocument=\{\"Version\":\"2012-10-17\",\"Statement\":\[\{\"Effect\":\"Allow\",\"Principal\":\{\"AWS\":\[\"arn:aws:iam:::user/TESTER2\"\]\},\"Action\":\[\"sts:AssumeRole\"\]\}\]\}"
Add/ Update a Policy attached to a Role
---------------------------------------
Example::
POST "<hostname>?Action=PutRolePolicy&RoleName=S3Access&PolicyName=Policy1&PolicyDocument=\{\"Version\":\"2012-10-17\",\"Statement\":\[\{\"Effect\":\"Allow\",\"Action\":\[\"s3:CreateBucket\"\],\"Resource\":\"arn:aws:s3:::example_bucket\"\}\]\}"
List Permission Policy Names attached to a Role
-----------------------------------------------
Example::
POST "<hostname>?Action=ListRolePolicies&RoleName=S3Access"
..code-block:: XML
<PolicyNames>
<member>Policy1</member>
</PolicyNames>
Get Permission Policy attached to a Role
----------------------------------------
Example::
POST "<hostname>?Action=GetRolePolicy&RoleName=S3Access&PolicyName=Policy1"