Skip to main content

Appx. AWS STS issuance

This article walks you through an example of creating and utilizing temporary security credentials to control access to AWS S3 resources using AWS Security Token Service (AWS STS).

info

For a list of S3 API Features provided by KakaoCloud, please refer to the S3 document.

API preparations

Please refer to the API Preparation for the preparatory work required to call the API.

STS token

Use AssumeRoleWithWebIdentity to issue an access key ID, secret access key, and security token to access resources in AWS. You can use Openstack tokens to create temporary credentials with the permissions of the token user.

Request
Issue STS Token
curl -X POST \ 'https://objectstorage.kr-central-2.kakaocloud.com/' \
--header 'Accept: */*' \
--header 'Content-Type: application/json' \
--data-raw '{
"Action" : "AssumeRoleWithWebIdentity",
"DurationSeconds": 1800;
"ProviderId" : "iam.kakaocloud.com",
"WebIdentityToken" : "{x-auth-token}"
}'
methodRequest URL
POSThttps://objectstorage.kr-central-2.kakaocloud.com/
fieldFormatDescription
Action*StringType of action to perform
- Only AssumeRoleWithWebIdentity is supported
DurationSecondsIntHow long temporary credentials are valid
ProviderIdStringThe entity that provides WebIdentity.
- Currently only iam.kakaocloud.com is provided
WebIdentityTokenStringToken issued by Openstack
Response
Response example
<AssumeRoleWithWebIdentityResponse>
<AssumeRoleWithWebIdentityResult>
<SubjectFromWebIdentityToken>{user_id}</SubjectFromWebIdentityToken>
<Credentials>
<SessionToken>{session_token}</SessionToken>
<SecretAccessKey>{session_secret_key}</SecretAccessKey>
<Expiration>{expiration}</Expiration>
<AccessKeyId>{session_access_key}</AccessKeyId>
</Credentials>
<Provider>iam.kakaocloud.com</Provider>
</AssumeRoleWithWebIdentityResult>
<ResponseMetadata>
<RequestId>{request_id}</RequestId>
</ResponseMetadata>
</AssumeRoleWithWebIdentityResponse>
fieldTypeDescription
user_idStringUser ID for which temporary credentials will be used
session_tokenStringSession token for temporary credentials
session_secret_keyStringSecret access key for temporary credentials
session_access_keyStringSecret access key ID for temporary credentials
expirationTimestampExpiration time for temporary credentials
response codeResponseDescription
200OKSuccess
400BadRequestRequest information error
403ForbiddenNo permission

Example - get bucket list

Query bucket list
curl --location 'https://objectstorage.kr-central-2.kakaocloud.com/' \
--header 'X-Amz-Security-Token: {Issued STS Session Token}' \
--header 'X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' \
--header 'X-Amz-Date: 20230719T074808Z' \
--header 'Authorization: AWS4-HMAC-SHA256 Credential=2d554f581e81aa56a120fc29bd806405/20230719/kr-central-2/s3/aws4_request, SignedHeaders=host;x-amz-content-sha256;x-amz-date;x-amz-security -token, Signature=3f0f3cd5a25406947c936e8d51cdd13f3d5b4fafa1078da4e1b7b3df0d1e662a'