Scrivio Interview library

AWS for Java developers

20 questions in 6 subtopics.

AWS SDK for Java and S3

CodingFoundations7 min read
Using the AWS SDK for Java 2.x, show how a Spring Boot service uploads a file to S3, downloads it, and creates a presigned URL valid for 10 minutes. How should the S3Client be created and shared, and how does it find credentials and the region?
DebuggingIntermediate6 min read
After a traffic increase, a service that reads objects from S3 starts failing with "Unable to execute HTTP request: Timeout waiting for connection from pool". CPU and S3 latency look normal. The code is:
ResponseInputStream<GetObjectResponse> in = s3.getObject(req);
return parseHeader(in); // reads the first 512 bytes
What is wrong and how do you fix it?
ScenarioIntermediate7 min read
A Java service must upload video files of up to 20 GB to S3 from a container with 1 GB of memory, and sometimes uploads fail halfway. Describe how you would implement this with the AWS SDK for Java 2.x and what you would configure in the bucket.
LeadershipPrincipal9 min read
Your company has about 200 Java services, a third still on AWS SDK for Java 1.x, and some on libraries that pull in 1.x transitively. SDK 1.x is past end of support. How do you plan and govern the migration to 2.x, and what do you learn for future SDK changes?

AWS Lambda with Java

CodingFoundations7 min read
Write a minimal AWS Lambda handler in Java that receives an API Gateway event and returns a JSON response. Explain where you would create SDK clients and database connections, and what affects cold start time for Java functions.
ScenarioIntermediate7 min read
A Java 21 Spring Boot function on AWS Lambda has cold starts of 6 to 8 seconds, and the API it backs has a p99 target of 1 second. Compare SnapStart, provisioned concurrency, GraalVM native images and tuning, including the correctness risks of SnapStart.
DesignAdvanced6 min read
Your organization has 60 Java services on containers and teams want to move some to AWS Lambda. Several of them use PostgreSQL through Hibernate, and one handles steady 2,000 requests per second. How do you decide which services fit Lambda, and what platform rules do you set?

SQS and SNS from Java

CodingFoundations7 min read
Write the core loop of a Java SQS consumer using the AWS SDK 2.x, and explain long polling, visibility timeout, deleting messages and dead-letter queues. How does Spring Cloud AWS simplify it?
DebuggingIntermediate6 min read
A Java SQS consumer occasionally processes the same message twice, and some messages end up in the dead-letter queue although processing eventually succeeded. Processing usually takes 10 seconds but sometimes 90 seconds; the visibility timeout is 30 seconds and maxReceiveCount is 3. Explain and fix.
DesignIntermediate7 min read
An order service publishes OrderPlaced events that billing, shipping and analytics must each receive, and billing must process events for the same order in order. Design this with SNS and SQS from Java, covering FIFO topics and queues, deduplication, filtering and idempotency.
DesignAdvanced6 min read
Your company's Java services use SQS and SNS, a self-managed Kafka cluster, Amazon EventBridge and RabbitMQ, chosen team by team. Messages cross between them through custom bridges. As a principal engineer, what standard would you propose for messaging on AWS?

IAM roles and credentials for Java services

ConceptFoundations6 min read
How should a Java service running on AWS get credentials to call S3 and DynamoDB? Explain the default credentials provider chain in the AWS SDK for Java 2.x, and how roles reach the service on EC2, ECS and EKS. What should never be done?
DebuggingIntermediate6 min read
On EKS, a Java service configured with IRSA (an annotated service account) gets AccessDenied errors, and CloudTrail shows the calls come from the node's instance role, not the service role. The pod has AWS_ROLE_ARN and AWS_WEB_IDENTITY_TOKEN_FILE set. What are the likely causes in the Java application?
LeadershipPrincipal6 min read
Your company runs about 300 Java services across 40 AWS accounts. A security review found broad IAM policies, long-lived access keys in CI systems and on developer laptops, and no one can say which service can reach which data. How do you set IAM governance for the next several years?

Secrets Manager and Parameter Store

ConceptFoundations6 min read
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.
ScenarioIntermediate7 min read
A Spring Boot service with a HikariCP pool reads its PostgreSQL password from AWS Secrets Manager at startup. After automatic rotation, new connections fail with authentication errors until the pods are restarted. Explain why, and design a rotation that causes no errors.

Running Java on ECS, EKS and Elastic Beanstalk

ConceptFoundations6 min read
Compare Amazon ECS with Fargate, Amazon EKS and AWS Elastic Beanstalk for running a Spring Boot service. What do you manage yourself in each, and when would you choose each one?
DebuggingIntermediate7 min read
A Spring Boot service on ECS Fargate with 0.5 vCPU and 1 GB memory is killed and restarted in a loop: tasks are marked unhealthy during startup, and some tasks stop with exit code 137. Explain the likely causes and the settings you would change.
DesignAdvanced6 min read
Your company is moving 150 Java services from Elastic Beanstalk and hand-built EC2 instances to containers. Teams are split between ECS on Fargate and EKS. How do you make the platform decision, and what do you standardize for Java workloads regardless of the choice?
LeadershipPrincipal7 min read
Your AWS bill for Java workloads has grown 40 percent a year. The CFO asks for a plan. What levers do you consider for compute running Java services, such as Graviton (ARM) instances, right-sizing JVMs, Savings Plans and runtime choices, and how do you govern cost over several years?