Chapter 14: EC2 Operations — Elastic IP, AMI, Snapshots and Vertical Scaling
Interview Questions
These questions on Elastic IP, AMI, snapshots and scaling surely come up in cloud interviews. Give a real scenario in every answer – like replacing a server using an EIP.
Elastic IP, AMI, स्नॅपशॉट्स आणि स्केलिंगवर हे प्रश्न क्लाउड इंटरव्ह्यूमध्ये नक्की येतात. प्रत्येक उत्तरात एक खरा सिनॅरिओ सांगा – जसं EIP ने सर्व्हर बदलणं.
Elastic IP, AMI, स्नैपशॉट्स और स्केलिंग पर ये सवाल क्लाउड इंटरव्यू में ज़रूर आते हैं. हर जवाब में एक असली सिनेरियो बताओ – जैसे EIP से सर्वर बदलना.
- Q1. What is an Elastic IP and why is it needed?
- A static public IPv4 address owned by your account. The auto-assigned public IP changes on stop/start; an EIP stays the same and can be moved between instances, so DNS records don't need to change.
- Q2. How would you replace a web server without changing DNS?
- Build and test the new instance, then re-associate the Elastic IP from the old instance to the new one (allow reassociation). Traffic switches within seconds; keep the old instance briefly for rollback.
- Q3. What does an AMI consist of?
- One or more EBS snapshots (root and optionally data volumes), a block device mapping, launch permissions and metadata such as architecture and virtualization type.
- Q4. What is the risk of the "No reboot" option when creating an AMI?
- The filesystem is captured while running, so in-flight writes may not be flushed and the image may be inconsistent (crash-consistent); databases might need recovery.
- Q5. Are EBS snapshots full or incremental? Where are they stored?
- Incremental — only changed blocks after the first snapshot. They are stored in Amazon S3, managed by AWS (not visible in your buckets), and are regional.
- Q6. How do you restore a single deleted file from an EBS snapshot?
- Create a volume from the snapshot in the instance's AZ, attach it, mount it read-only (with
nouuidfor XFS on the same instance), copy the file back, then unmount, detach and delete the temporary volume. - Q7. How do you automate EBS snapshots?
- Use Amazon Data Lifecycle Manager (tag-based policies with schedules and retention) or AWS Backup.
- Q8. What is the difference between vertical and horizontal scaling? What changes when you change an instance type?
- Vertical = bigger instance (needs stop/start); horizontal = more instances behind a load balancer (ASG + ELB). After a type change, the auto-assigned public IP changes (unless EIP) and instance store data is lost; EBS data, private IP and instance ID stay.