Scrivio Interview library
ConceptFoundations6 min read · updated 12 November 2026

Compare AWS Secrets Manager and Systems Manager Parameter Store for configuration and secrets in a Spring Boot service. Show how Spring Cloud AWS loads values at startup, and what you should cache.

Parameter Store is the cheap, simple place for configuration and for SecureString values encrypted with KMS, with free standard parameters, while Secrets Manager costs per secret but adds what secrets need: automatic rotation, versioning and cross-account sharing. In Spring Boot, Spring Cloud AWS loads both at startup through spring.config.import, for example aws-secretsmanager:/prod/orders/db and aws-parameterstore:/config/orders/, so the values become ordinary properties such as spring.datasource.password. We cache values instead of calling AWS per request, and the service role needs secretsmanager:GetSecretValue, ssm:GetParametersByPath and kms:Decrypt for the keys used.

Why this question is asked

Every service needs configuration and some secrets, and on AWS there are two services that look alike. Picking the wrong one either costs money for nothing or leaves database passwords without rotation. Interviewers ask this to see whether we know the difference, whether we can wire them into Spring Boot without AWS calls scattered through the code, and whether we avoid the classic mistake of calling the API on every request. In this answer, we will compare the two services, load values with Spring Cloud AWS, see how they turn into normal properties, look at caching and quotas, and set up the IAM permissions.

1A Quick Recap of the Two Services

AWS Systems Manager Parameter Store is a hierarchical key-value store. Parameters have paths such as /config/orders/feature.discounts, and three types: String, StringList and SecureString, which is encrypted with a KMS key. Standard parameters, up to 4 KB, are free; advanced parameters allow larger values and policies such as expiration for a small monthly charge, and higher API throughput can be enabled for a fee.

AWS Secrets Manager is built only for secrets. Each secret, often a JSON document with a username and password, costs a small monthly fee plus a charge per API call. In return it offers automatic rotation with Lambda functions, including ready-made rotation for RDS and Aurora databases, version stages such as AWSCURRENT and AWSPREVIOUS, resource policies for sharing with other accounts, and replication to other regions.

Parameter Store or Secrets Manager?
FeatureParameter StoreSecrets Manager
Main useconfiguration, simple secretscredentials that rotate
EncryptionSecureString with KMSalways encrypted with KMS
Coststandard parameters freeper secret per month plus API calls
Rotationnone built inmanaged rotation, RDS templates
Versionsparameter historyversion stages (current, previous)
Cross-account sharinglimitedresource policies
A common split: configuration in Parameter Store, credentials in Secrets Manager.

2Loading Values at Startup With Spring Cloud AWS

Spring Boot's config data API lets us import extra property sources with spring.config.import. Spring Cloud AWS adds two prefixes for it. We add the starters for Secrets Manager and Parameter Store and list what to import.

YAML
# application.yml
spring:
config:
import:
- aws-secretsmanager:/prod/orders/db # JSON secret: its keys become properties
- aws-parameterstore:/config/orders/ # every parameter under this path
datasource:
url: jdbc:postgresql://orders-db:5432/orders
username: ${username} # from the secret's "username" key
password: ${password} # from the secret's "password" key

At startup, before the application context is created, Spring Cloud AWS calls Secrets Manager once for the secret and Parameter Store for all parameters under the path, and adds them to the Environment. A JSON secret such as {"username":"orders_app","password":"..."} becomes the properties username and password. A parameter /config/orders/feature.discounts becomes the property feature.discounts. If a source is missing, startup fails, unless we prefix it with optional:, which is useful for values that only some environments have. The exact naming rules, such as adding a prefix to imported keys, are configurable; check the reference for your Spring Cloud AWS version.

3Why Normal Properties Matter

Once loaded, the values are just properties. HikariCP gets its password from spring.datasource.password as usual, @Value and @ConfigurationProperties work, and the application code never calls AWS or even knows where a value came from. In local development and tests we provide the same properties from a profile file or Testcontainers, without AWS at all.

Java
@ConfigurationProperties(prefix = "feature")
record FeatureFlags(boolean discounts, int maxItems) { }
// /config/orders/feature.discounts = true -> flags.discounts() == true
// /config/orders/feature.maxItems = 50 -> flags.maxItems() == 50

4What to Cache, and Why

Both services have API rate limits and Secrets Manager charges per call. A service that fetches a secret on every request will hit throttling under load and pay for millions of calls a month. Loading at startup, as above, is the simplest cache: one call per instance start.

When code must read secrets directly, for example a secret chosen per tenant, we use a cache with a refresh interval, such as the AWS Secrets Manager caching client for Java, which keeps values in memory and refreshes them after a configurable time, by default one hour. Parameter Store values read directly deserve the same treatment with a simple time-based cache.

Java
SecretCache cache = new SecretCache(); // from aws-secretsmanager-caching-java
String json = cache.getSecretString("/prod/tenants/acme/api-key"); // first call: API request
String again = cache.getSecretString("/prod/tenants/acme/api-key"); // later calls: from memory

5The IAM Permissions the Service Needs

The service's role needs read access to exactly its own secrets and parameters: secretsmanager:GetSecretValue on the secret ARN, ssm:GetParametersByPath and ssm:GetParameter on the parameter path, and kms:Decrypt on the KMS key that encrypts them. If the secret or SecureString uses the AWS managed key, the KMS permission is usually granted through the service integration; with a customer managed key, the key policy or the role must allow kms:Decrypt explicitly, and forgetting it produces an AccessDenied that mentions KMS rather than Secrets Manager. Scoping by path, such as /config/orders/*, keeps one service from reading another's configuration.

6Follow-up questions

How would you load a new secret value without restarting?

There are three common ways. Spring Cloud AWS supports reloading for imported sources in recent versions, polling at an interval and refreshing @ConfigurationProperties beans or the context; check your version's reload settings. For database passwords specifically, a reloaded property does not change an existing HikariDataSource, so we use a driver or wrapper that fetches the current secret when it opens a connection, such as the AWS Advanced JDBC Wrapper's Secrets Manager plugin. And for code that reads secrets directly, the caching client's refresh interval picks up new versions automatically.

Is a SecureString parameter good enough for a database password?

It is encrypted and access-controlled, so it is acceptable for passwords that are rotated by hand. What it lacks is managed rotation and version stages, so when we want automatic rotation, which we should for production databases, Secrets Manager is the right home.

Should secrets be passed as environment variables instead?

ECS can inject secrets from either service as environment variables at task start, which also avoids code changes. The downside is that they are visible to anything that can read the process environment and are fixed until the task restarts. Loading through Spring Cloud AWS or a driver plugin keeps more control.

7Conclusion

In this answer, we compared Parameter Store, free and simple for configuration and SecureString values, with Secrets Manager, paid per secret but with rotation, version stages and cross-account sharing. Spring Cloud AWS imports both through spring.config.import at startup so values become normal properties, we cache instead of calling AWS per request, and the role needs GetSecretValue, parameter read permissions and kms:Decrypt for the keys used.

What to say in the interviewAbout 90 seconds aloud

Open with

Parameter Store is a hierarchical key-value store for configuration. It can hold SecureString values encrypted with KMS, and standard parameters are free, so I use it for feature flags, URLs and settings.

Then, if they want more

Secrets Manager is built for secrets: it costs per secret per month plus API calls, but it gives automatic rotation, including ready-made rotation for RDS, version stages like current and previous, and resource policies for cross-account sharing. So database credentials and API keys that should rotate go to Secrets Manager.

In Spring Boot I use Spring Cloud AWS with spring.config.import, for example aws-secretsmanager:/prod/orders/db and aws-parameterstore:/config/orders/. At startup it reads them once and adds them to the Environment: the keys of a JSON secret become properties, and parameters under the path become properties named after the rest of the path.

So spring.datasource.password just references the secret's password key, and the application code never calls AWS, which also makes local testing easy. I would not call the APIs per request, because both services have rate limits and Secrets Manager charges per call.

Loading at startup is the simplest cache, and if code needs to read secrets directly I use the AWS caching client with a refresh interval. The service role needs secretsmanager:GetSecretValue on its own secrets, ssm:GetParametersByPath on its own path, and kms:Decrypt on the keys, especially when they are customer managed.

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.
Official documentation
AWS documentation
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 "Compare AWS Secrets Manager and Systems Manager Parameter Store for configuration and...": https://scrivio-interview-library.netlify.app/spring-boot/aws/952b24c9a6/