AWS Lambda
- How did you handle cold starts in AWS Lambda with Spring Boot?
- (Spring Boot + Cold Start) issue specific with SB
Amazon S3
- What is S3 Lifecycle Management, and how did you use it?
- How did you ensure security for data stored in S3?
Amazon DynamoDB
- How is DynamoDB different from Amazon RDS?
- Does DynamoDB have indexes? If yes, what types and how are they used?
- What is TTL in dynamo db?
Amazon RDS
- Does Amazon RDS support indexing?
- What are the types of indexes supported in RDS, and how do they compare with DynamoDB indexes?
CI/CD on AWS
- What CI/CD tools did you use with AWS?
Answers
AWS Lambda
- How did you handle cold starts in AWS Lambda with Spring Boot?
- “used Spring Cloud Function to reduce Lambda cold starts by packaging only the required business logic as a Java Function. This allowed us to skip full context loading and significantly reduced cold start latency compared to traditional Spring Boot REST applications. We combined this with SnapStart and minimal dependencies to get near real-time performance.”
Cold Start Comparison (Typical Benchmarks)
| Framework | Cold Start Time (avg) |
|---|---|
| Spring Boot REST API | 3–6 seconds |
| Spring Cloud Function | 1–2 seconds (less with SnapStart) |
| Micronaut | < 1 second |
| Quarkus + GraalVM | ~100–200ms |
Best practise for spring-boot + AWS lambda :
| Aspect | Recommendation |
|---|---|
| Framework | Use Spring Boot (bare minimum) or Micronaut/Quarkus |
| Avoid | Heavy Spring Cloud modules in Lambda |
| Use | Provisioned Concurrency or SnapStart |
| Better Fit | Use Spring Cloud in ECS, EC2, or EKS-based services |
Use case:
We had structured profile data (name, phone, address), so used Amazon RDS (MySQL). Our Spring Cloud Function-based Lambda connects to RDS using JDBC and fetches user data using a simple SELECT query. We expose this via API Gateway as a REST endpoint. This setup leverages schema constraints and relational features of RDS while keeping cold starts optimized via provisioned concurrency and SnapStart (if needed).
// FunctionConfig.java
@Configuration
public class FunctionConfig {
private final JdbcTemplate jdbcTemplate;
public FunctionConfig(DataSource dataSource) {
this.jdbcTemplate = new JdbcTemplate(dataSource);
}
@Bean
public Function<Map<String, String>, Map<String, Object>> getProfile() {
return input -> {
String userId = input.get("userId");
try {
return jdbcTemplate.queryForMap(
"SELECT name, phone, address FROM user_profile WHERE id = ?",
userId
);
} catch (EmptyResultDataAccessException e) {
return Map.of("error", "User not found");
}
};
}
}
//Handler
public class LambdaHandler extends SpringBootRequestHandler<Map<String, String>, Map<String, Object>> {}
Amazon S3
- What is S3 Lifecycle Management, and how did you use it?
- Lifecycle rules automate transitions and deletions:
- Moved objects to Standard-IA after 30 days, Glacier after 90 days, and deleted after 365 days.
- Useful for logs, reports, and backup data where older versions are rarely accessed.
- Managed versioned data with separate rules for current and non-current versions.
- Lifecycle rules automate transitions and deletions:
- How did you ensure security for data stored in S3?
- Enabled encryption at rest using SSE-S3 or SSE-KMS for sensitive data.
- Applied bucket policies and IAM roles with least privilege.
- Blocked public access at the account and bucket level.
- Used VPC endpoints for private access without exposing S3 to the internet.
- Enabled object-level logging and AWS Config rules for audit trails.
Amazon DynamoDB
- How is DynamoDB different from Amazon RDS?
| Feature | DynamoDB | RDS (e.g., PostgreSQL) |
|---|---|---|
| Type | NoSQL | Relational SQL |
| Schema | Schema-less | Schema-based |
| Scaling | Auto (serverless/provisioned) | Vertical (read replicas needed) |
| Querying | Key-based + Indexes | Rich SQL support |
| Joins | ❌ Not supported | ✅ Fully supported |
| Use cases | Fast reads, IoT, session data | Reporting, analytics, joins |
- Does DynamoDB have indexes? If yes, what types and how are they used?
- Yes, it supports:
- Primary Index: Partition Key (and optional Sort Key)
- Global Secondary Index (GSI): Alternate PK/SK, used for flexible queries
- Local Secondary Index (LSI): Same PK, different Sort Key
Indexes are critical for enabling non-primary key access patterns.
- Yes, it supports:
- What is partition key ?
- What is TTL in dynamo db?
- TTL automatically deletes expired items using a timestamp field (epoch seconds).
- We used it for sessions, temporary tokens, and cache entries.
- TTL field was named
expiryTimeand enabled at table level. - Combined with DynamoDB Streams to track deletion events.
- TTL automatically deletes expired items using a timestamp field (epoch seconds).
Amazon RDS
- Does Amazon RDS support indexing?
- Yes. RDS supports all traditional index types:
- Primary Key
- Secondary Indexes
- Composite Indexes
- Full-text and functional indexes depending on the engine (e.g., PostgreSQL, MySQL).
We used them to optimize search, filters, and JOIN-heavy queries.
- Yes. RDS supports all traditional index types:
CI/CD on AWS
What CI/CD tools did you use with AWS?
Answer:
- Used CodePipeline + CodeBuild for AWS-native CI/CD.
- Integrated with GitHub Actions and Jenkins to build Docker images.
- Deployed to ECS Fargate, Lambda, or EKS with blue/green or canary deployments.
- Stored artifacts in S3 and container images in ECR.