- Newest
- Most votes
- Most comments
How about using a Refreshable Credentials Provider, the AWS SDK for Java supports auto-refreshing credentials if you use a provider that supports it. However, the ProfileCredentialsProvider does not auto-refresh credentials if they are generated by an external process (like aws sso login or aws sts assume-role). Instead, consider: • Using DefaultCredentialsProvider, which checks multiple sources (including environment variables, EC2/ECS metadata, etc.). • Using ProcessCredentialsProvider if your profile uses credential_process to fetch credentials dynamically. If you're using aws sso or sts assume-role, configure your profile like this:
[profile kafka-msk]
credential_process = aws sso get-role-credentials --role-name ... --account-id ... --region ...
This allows the SDK to invoke the process automatically to refresh credentials.
Hey,
Hope you're keeping well.
For long‑running Spring Boot MSK clients, you’ll need a credentials provider that can automatically refresh before expiry. ProfileCredentialsProvider only loads credentials once, so if your profile uses temporary STS or SSO tokens it will stop working after an hour. Instead, configure your AWS profile with credential_process or use DefaultCredentialsProvider, which will re‑resolve credentials from sources like SSO, STS, or environment variables on demand. If using SSO, run aws sso login beforehand and ensure your profile uses the SSO config so the SDK refreshes automatically. This way your Kafka producer can keep publishing without manual intervention.
Thanks and regards,
Taz
answered 8 months ago
Relevant content
asked 3 years ago
asked 4 years ago
