GetDataAccess
Returns a temporary access credential from S3 Access Grants to the grantee or client application. The temporary credential is an Amazon STS token that grants them access to the S3 data.
- Permissions
-
You must have the
s3:GetDataAccess
permission to use this operation. - Additional Permissions
-
The IAM role that S3 Access Grants assumes must have the following permissions specified in the trust policy when registering the location:
sts:AssumeRole
, for directory users or groupssts:SetContext
, and for IAM users or rolessts:SetSourceIdentity
.
Request Syntax
GET /v20180820/accessgrantsinstance/dataaccess?durationSeconds=DurationSeconds
&permission=Permission
&privilege=Privilege
&target=Target
&targetType=TargetType
HTTP/1.1
Host: s3-control.amazonaws.com.cn
x-amz-account-id: AccountId
URI Request Parameters
The request uses the following URI parameters.
- durationSeconds
-
The session duration, in seconds, of the temporary access credential that S3 Access Grants vends to the grantee or client application. The default value is 1 hour, but the grantee can specify a range from 900 seconds (15 minutes) up to 43200 seconds (12 hours). If the grantee requests a value higher than this maximum, the operation fails.
Valid Range: Minimum value of 900. Maximum value of 43200.
- permission
-
The type of permission granted to your S3 data, which can be set to one of the following values:
-
READ
– Grant read-only access to the S3 data. -
WRITE
– Grant write-only access to the S3 data. -
READWRITE
– Grant both read and write access to the S3 data.
Valid Values:
READ | WRITE | READWRITE
Required: Yes
-
- privilege
-
The scope of the temporary access credential that S3 Access Grants vends to the grantee or client application.
-
Default
– The scope of the returned temporary access token is the scope of the grant that is closest to the target scope. -
Minimal
– The scope of the returned temporary access token is the same as the requested target scope as long as the requested scope is the same as or a subset of the grant scope.
Valid Values:
Minimal | Default
-
- target
-
The S3 URI path of the data to which you are requesting temporary access credentials. If the requesting account has an access grant for this data, S3 Access Grants vends temporary access credentials in the response.
Length Constraints: Minimum length of 1. Maximum length of 2000.
Pattern:
^.+$
Required: Yes
- targetType
-
The type of
Target
. The only possible value isObject
. Pass this value if the target data that you would like to access is a path to an object. Do not pass this value if the target data is a bucket or a bucket and a prefix.Valid Values:
Object
- x-amz-account-id
-
The Amazon account ID of the S3 Access Grants instance.
Length Constraints: Maximum length of 64.
Pattern:
^\d{12}$
Required: Yes
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
<?xml version="1.0" encoding="UTF-8"?>
<GetDataAccessResult>
<Credentials>
<AccessKeyId>string</AccessKeyId>
<Expiration>timestamp</Expiration>
<SecretAccessKey>string</SecretAccessKey>
<SessionToken>string</SessionToken>
</Credentials>
<MatchedGrantTarget>string</MatchedGrantTarget>
</GetDataAccessResult>
Response Elements
If the action is successful, the service sends back an HTTP 200 response.
The following data is returned in XML format by the service.
- GetDataAccessResult
-
Root level tag for the GetDataAccessResult parameters.
Required: Yes
- Credentials
-
The temporary credential token that S3 Access Grants vends.
Type: Credentials data type
- MatchedGrantTarget
-
The S3 URI path of the data to which you are being granted temporary access credentials.
Type: String
Length Constraints: Minimum length of 1. Maximum length of 2000.
Pattern:
^.+$
See Also
For more information about using this API in one of the language-specific Amazon SDKs, see the following: