AWS for Java developers
20 questions in 6 subtopics.
AWS SDK for Java and S3
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 theS3Client be created and shared, and how does it find credentials and the region?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
AWS Lambda with Java
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.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. CompareSnapStart, provisioned concurrency, GraalVM native images and tuning, including the correctness risks of SnapStart.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
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?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 andmaxReceiveCount is 3. Explain and fix.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.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
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?On EKS, a Java service configured with IRSA (an annotated service account) getsAccessDenied 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?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
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.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
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?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.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?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?No question matches these choices.