Authentication with the Yandex Cloud Postbox API
Written by
Updated at October 22, 2024
You can access Yandex Cloud Postbox using the Amazon API. For authentication, use a static access key or an IAM token. This way, you will run all operations as the service account the static key or IAM token was issued to. For more information, see How to use the API.
To access the Amazon API directly, without the AWS CLI or apps, use one of these methods:
- Manually generate a request signature and provide it in the
Authorization
header. To learn more about signing requests and verifying signatures, see Signing requests. - Authenticate with an IAM token you get for the service account and provide it in the
X-YaCloud-SubjectToken
header. In this case, you do not need theAuthorization
header and signature.
Amazon API use cases
The examples below show how to get a list of configurations with a request sent via cURL
Before you start, create a service account with the appropriate role. The postbox.viewer
role works well for these examples.
Authentication with a static key
-
Create a static key for the service account.
-
Run this request:
export AWS_KEY_ID="<static_key_ID>" && \ export AWS_SECRET_KEY="<secret_key>" && \ curl \ --request GET \ --user "${AWS_KEY_ID}:${AWS_SECRET_KEY}" \ --aws-sigv4 "aws:amz:ru-central1:ses" \ --url 'https://postbox.cloud.yandex.net/v2/email/configuration-sets' \ --verbose
Authentication using an IAM token
-
Get an IAM token for the service account.
-
Run this request:
export IAM_TOKEN="<IAM_token>" && \ curl \ --request GET \ --header "X-YaCloud-SubjectToken: ${IAM_TOKEN}" \ --url 'https://postbox.cloud.yandex.net/v2/email/configuration-sets' \ --verbose