n cloud environments using AWS, Mediacenter obtains credentials through the AWS STS service, which provides a temporary token to avoid storing credentials on the frontend and enhance security.

If you wish to test this part of the code, you need to set up a temporary infrastructure to run the necessary tests with stsClient.

LocalStack Configuration for Token Retrieval in Local Environments

LocalStack is a tool that emulates AWS services locally, including STS, S3, IAM, and more. This allows you to test and develop without needing access to a real AWS account.

Docker Configuration

Use the localstack image wich has AWS STS service enabled in local environtments

docker run \\
  --rm -it \\
  --name localstack \\
  -p 4566:4566 \\
  -p 4510-4559:4510-4559 \\
  -v /var/run/docker.sock:/var/run/docker.sock \\
  -v ./localstack:/var/lib/localstack \\
  localstack/localstack

STS Configuration in LocalStack

Commands to Create Users and Buckets

Access the LocalStack Container

docker exec -it localstack bash

Create a User

awslocal iam create-user --user-name xalok_api

Expected response:

{
    "User": {
        "Path": "/",
        "UserName": "xalok_api",
        "UserId": "0uw3dkxtisyd4rtcuu43",
        "Arn": "arn:aws:iam::000000000000:user/xalok_api",
        "CreateDate": "2025-01-20T12:20:10.277000Z"
    }
}

Create an Access Key for the User

awslocal iam create-access-key --user-name xalok_api

Expected response:

{
    "AccessKey": {
        "UserName": "xalok_api",
        "AccessKeyId": "LKIAQAAAAAAAKXSP6SRZ",
        "Status": "Active",
        "SecretAccessKey": "vSBXsxiq2B4V9vzeziydEERY0bemalre55qwYJG+",
        "CreateDate": "2025-01-20T12:20:22Z"
    }
}

Bucket creation