Scrivio Interview library
DesignIntermediate7 min read · updated 12 November 2026

How would you load secrets and configuration from AWS Secrets Manager and Parameter Store into a Spring Boot service with Spring Cloud AWS, and what are the operational trade-offs?

With Spring Cloud AWS we add spring.config.import=aws-secretsmanager:/prod/orders,aws-parameterstore:/config/orders/ so the secret's keys and every parameter under the path become Spring properties at startup. Credentials come from the default AWS provider chain, IRSA or EKS Pod Identity on EKS and instance profiles on EC2, never from static keys. The trade-offs are that startup now depends on AWS APIs and their throttling limits, that optional: should be used only where missing values are acceptable, and that rotation needs either refresh support or rolling restarts. Kubernetes alternatives such as the External Secrets Operator or the Secrets Store CSI driver keep the application cloud-neutral.

Why this question is asked

Every service needs secrets, such as database passwords and API keys, and configuration, such as URLs and limits, and on AWS the managed homes for them are Secrets Manager and Systems Manager Parameter Store. Spring Cloud AWS can read both directly into the Spring Environment, which is convenient. Interviewers ask this design question because the convenience comes with operational consequences that matter at scale. In this answer, we will recap the two AWS services, wire them in with spring.config.import, see where credentials come from, look at what can go wrong at startup, handle rotation, and compare with the Kubernetes-native alternatives.

1A Quick Recap of the Two AWS Services

AWS Secrets Manager stores secrets, encrypted with KMS, with fine-grained access control, an audit trail in CloudTrail and built-in rotation for databases such as RDS. A secret is usually a small JSON document, for example {"username": "orders", "password": "..."}, and it is priced per secret per month plus API calls.

Parameter Store, part of Systems Manager, stores parameters in a hierarchy of paths, such as /config/orders/max-items. Values can be plain strings or SecureString values encrypted with KMS. Standard parameters cost nothing to store, which makes Parameter Store a common choice for ordinary configuration, while Secrets Manager is used for secrets that need rotation.

2Loading Both With spring.config.import

We add spring-cloud-aws-starter-secrets-manager and spring-cloud-aws-starter-parameter-store, and import both locations. Spring Boot loads them while preparing the Environment, before any bean is created, so a DataSource sees the password at startup like any other property.

YAML
# application.yml of the orders service
spring:
config:
import:
- aws-secretsmanager:/prod/orders
- aws-parameterstore:/config/orders/
datasource:
url: jdbc:postgresql://orders-db.internal:5432/orders
username: ${username} # key from the /prod/orders secret's JSON
password: ${password}
# Secret /prod/orders = {"username":"orders","password":"s3cr3t"}
# -> properties username=orders, password=s3cr3t
# Parameters /config/orders/max-items = 50, /config/orders/payment.base-url = http://...
# -> properties max-items=50, payment.base-url=http://...

Notice how names are derived: each key of a JSON secret becomes a property, and each parameter under the path becomes a property named after the rest of its path. Generic names like username can clash between secrets, so Spring Cloud AWS supports a prefix per import (check your version for the syntax), which gives names such as orders.db.password.

3Where the Credentials Come From

To call these APIs, the application needs AWS credentials. Spring Cloud AWS uses the AWS SDK's default credentials provider chain, which checks several places in a fixed order. On EKS, we use IRSA (IAM roles for service accounts) or EKS Pod Identity: the pod's Kubernetes service account is linked to an IAM role, and the SDK exchanges a token for short-lived credentials automatically. On EC2 or ECS, the instance profile or task role does the same.

We never put access keys in configuration. Static keys get copied, leaked and never rotated, and they defeat the purpose of a secret store. The IAM role for the orders service gets permission to read only its own secret and parameter path, for example secretsmanager:GetSecretValue on /prod/orders and ssm:GetParametersByPath on /config/orders/, plus kms:Decrypt for the key that encrypts them.

Step throughStartup of the orders service on EKS
orders podAWS STSSecrets ManagerParameter Store
web identity token from the service account
short-lived credentials for role orders-prod
GetSecretValue /prod/orders
{username, password}
GetParametersByPath /config/orders/
max-items, payment.base-url
Environment ready: create beans

7 messages in order. Play them, or step through them one at a time.

4The Operational Trade-Offs

Startup now depends on AWS APIs. If STS, Secrets Manager or Parameter Store is unreachable or throttles us, the service cannot start. By default a failed import stops startup, which is usually right for a database password. The optional: prefix, as in optional:aws-parameterstore:/config/orders/, lets startup continue without those values; we use it only where the application has safe defaults, never for secrets it cannot run without.

Throttling matters at scale. These APIs have per-account, per-region request quotas, and Parameter Store's default throughput for reads is low, in the tens of requests per second unless higher throughput is enabled for a fee (check current quotas). Picture 300 pods restarting together after a node upgrade, each making several calls: the burst can hit the limit, and pods fail to start or retry slowly. We mitigate with fewer, larger reads (one secret with several keys rather than many secrets, one path read rather than many single parameters), staggered rollouts, and retries with backoff in the SDK client.

Local development also needs either real AWS access or an emulator such as LocalStack.

5Handling Rotation

Secrets Manager can rotate a database password on a schedule, for example every 30 days. The application loaded the old password at startup, so something must make it pick up the new one. Spring Cloud AWS has reload support for both sources that polls on a schedule and triggers a refresh of the Environment, which rebinds @ConfigurationProperties beans and recreates refresh-scoped beans (check your version for the property names and requirements). But a connection pool created at startup does not automatically reconnect with the new password; existing connections keep working until they close, and new ones need the new value.

The simpler and more predictable option is a rolling restart after rotation, triggered by the rotation event. Secrets Manager rotation for RDS also keeps the previous password valid for a while through its alternating users strategy, which gives time for the restart. Either way, we test rotation in a lower environment before relying on it.

6Cloud-Neutral Alternatives on Kubernetes

Instead of the application calling AWS, the platform can deliver the values. The External Secrets Operator reads Secrets Manager or Parameter Store and writes Kubernetes Secrets, which the pod mounts as files; the Secrets Store CSI driver mounts secrets directly as files in the pod. Spring Boot reads mounted files with the configtree: import, so the application only knows about files and stays the same on any cloud or on a laptop.

The trade-off is where the dependency lives. With Spring Cloud AWS, each application handles AWS calls and throttling itself, but needs no extra cluster component. With an operator, the cluster runs one more component and syncs on its own schedule, but applications become simpler and portable, and pod startup no longer calls AWS at all. For a platform with many services, I would usually prefer the operator.

Two ways to deliver the same secret
AspectSpring Cloud AWS importExternal Secrets / CSI driver
Application codeAWS-specific importsreads files, cloud-neutral
Startup depends on AWSyes, every pod startno, values synced beforehand
Throttling riskper pod at startupone operator, controlled sync
Rotationreload support or restartfile updates; restart or reload
Extra componentnoneoperator or driver in the cluster

7Follow-up questions

Secrets Manager or Parameter Store for a database password?

Secrets Manager, because it offers managed rotation, cross-account sharing and a clear audit trail for secrets. Parameter Store SecureString works for secrets that never rotate automatically and is cheaper, but for anything that should rotate, Secrets Manager is the better fit.

How do we test locally without AWS access?

Use a profile that does not import AWS locations and reads values from a local file, or run LocalStack, which emulates both services. The configtree approach makes this especially easy, because tests can just write files.

What about caching to reduce API calls?

Values are read once at startup, so caching matters mainly for reload polling. A longer polling period, for example several minutes, keeps calls low, and the operator approach reduces calls further by reading once per secret for the whole cluster rather than once per pod.

8Conclusion

In this answer, we loaded secrets and configuration with spring.config.import from aws-secretsmanager and aws-parameterstore locations, took credentials from the default provider chain through IRSA, Pod Identity or instance profiles, and looked at the costs: startup depends on AWS APIs and their quotas, optional: is only for values we can do without, and rotation needs reload support or rolling restarts. We also compared this with the External Secrets Operator and the Secrets Store CSI driver, which keep the application cloud-neutral.

What to say in the interviewAbout 100 seconds aloud

Open with

With Spring Cloud AWS 3, I would add the Secrets Manager and Parameter Store starters and import both in application.yml: aws-secretsmanager:/prod/orders and aws-parameterstore:/config/orders/. At startup each key of the JSON secret, and each parameter under the path, becomes a Spring property, so the DataSource can use the password like any other value, ideally with a prefix to avoid generic names clashing.

Then, if they want more

Credentials come from the AWS SDK default provider chain: on EKS that is IRSA or Pod Identity, linking the service account to an IAM role limited to that secret and that path, on EC2 the instance profile; never static keys in configuration. The trade-offs are operational.

Startup now depends on STS and these APIs, so if they fail or throttle, pods do not start. I would keep imports mandatory for secrets and use optional: only where safe defaults exist. With hundreds of pods restarting together, API quotas, especially Parameter Store's low default throughput, can be hit, so I would read fewer, larger items and stagger rollouts.

Rotation is the other point: the app read the password once, so either I use the reload support, knowing connection pools need care, or I trigger a rolling restart after rotation, which I find more predictable.

For a large Kubernetes platform, I would often prefer the External Secrets Operator or the Secrets Store CSI driver, which sync values into mounted files read with configtree, keeping the application cloud-neutral and removing AWS calls from startup.

About this answer

Last updated
12 November 2026
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "How would you load secrets and configuration from AWS Secrets Manager and Parameter...": https://scrivio-interview-library.netlify.app/spring-boot/spring-cloud/d6ec4b1bfc/