Friday, 22 August 2025

AWS discption QS

 

Basic AWS Interview Questions

Amazon Web Services (AWS) is an important cloud computing platform known for its wide service offerings. Its popularity is developed through its scalability, cost-effectiveness, and global infrastructure. Businesses increased the AWS to efficiently scale operations, reduce costs, and innovate rapidly.

2. Explain The Key Components Of AWS.

AWS provides the fundamental components crucial for cloud computing:

ServiceDescription
EC2 (Elastic Compute Cloud)Your virtual servers in the cloud. Need a Linux or Windows server for your web application? EC2 provides resizable compute capacity on demand.
S3 (Simple Storage Service)The internet's storage locker. S3 offers highly scalable and durable object storage for everything from website files and backups to big data analytics.
RDS (Relational Database Service)Managed database made easy. RDS simplifies the setup, operation, and scaling of popular relational databases like MySQL, PostgreSQL, and SQL Server.
IAM (Identity and Access Management)Your security guard in the cloud. IAM allows you to securely control access to AWS services and resources, defining who can do what.

3. What Is An EC2 Instance And How Does It Work?

An EC2 instance is essentially a virtual server running in the AWS cloud. When you "launch" an EC2 instance, you're setting up a virtual machine with the operating system and software stack you've selected (e.g., a Linux server with Apache).

How it works: AWS maintains the physical hardware, and you provision virtual resources on top of it. You choose an Amazon Machine Image (AMI), which acts as a template containing the OS, application server, and any pre-installed software. You then select an instance type, which defines the CPU, memory, storage, and networking capacity of your virtual server, tailoring it to your specific computing needs.

4. Describe The Difference Between S3 And EBS In AWS.

S3 ( Simple Storage Service ) is an object storage service suitable for storing various data types of files that can accessed through the internet. In contrast, EBS ( Elastic Block storage ) is a block-level storage attached to EC2 instances, offering persistent and high-performance storage for applications like databases. EBS provides the raw storage hardware helpful for I/O operations where as S3 comes with pre configured file system. For understanding think of S3 as a file storage system and EBS as a hard drive.

FeatureAmazon S3Amazon EBS
Storage TypeObject StorageBlock Storage
AccessVia HTTP/HTTPS URLsMounted as a file system on an EC2 instance
Use CasesStatic content, backups, data lakes, archivesOperating systems, databases, application storage
File SystemPre-configuredRaw block device; you manage the file system
PersistenceIndependent of EC2 instance lifecyclePersistent, but tied to a specific Availability Zone

5. How Does Auto Scaling Work In AWS?

Auto Scaling is like having an intelligent traffic manager for your application. It automatically adjusts the number of EC2 instances running your application based on real-time traffic demands and predefined policies. For instance, during the high traffic periods, Auto Scaling adds instances , improving optimal performance as per the policies configuration. Conversely, while during low traffic, it will reduce the number of instances , optimizes the cost efficiency maintaining high availability.

6. What Is The AWS Free Tier, And What Services Are Included?

The AWS Free Tier provides a set of AWS services for limited at no cost for the duration of 12 months. The services include EC2, S3, Lambda etc.. This helps the users to explore and experiment with AWS services without suffering with charges and helps in making a kick starting point for cloud beginners.

7. What Are Key-Pairs In AWS?

A key pair consists of two types of keys - a public key and a private key. The public key is used to encrypt data and stored on the AWS EC2 instance while a private key is used to decrypt data and is kept by the user. Whenever you want to connect to an AWS EC2 instance a key-pair works as a security credential to prove your secure authentication identity and access to EC2 instance via SSH.

8. What Is Elastic Load Balancing (ELB) And How Does It Function?

Elastic Load balancer ( ELB ) is a service provided by AWS that helps in distribution of incoming traffic of the applications across multi targets such as EC2 instances, containers etc.. in one or more Availability zones. It helps in improving fault tolerance and ensuring the utilization of resources, bringing high availability of the application by preventing a single node ( instance ) faulterance by improving application's resilience.

9. What Are The Various Load Balancers Provided By AWS?

The following are the types of load balancers provided by AWS:

  • Application Load Balancer: ALB works on layer 7(application layer) of OSI Model. It supports  HTTP, HTTPS, and gRPC protocols. and works on Round Robin algorithm.
  • Network Load Balancer: NLB works on layer 4(Transport layer) of OSI Model. It Supports TCP, UDP, and TLS protocols and works on Flow hash algorithm.
  • Gateway Load Balancer: GLB works on network layer (3 and 7).It supports IP-based routing and works on routing table lookup algorithm.

10. How Is Data Transfer Handled In AWS?

The data transfer in AWS happens in between regions, within regions, and between the services. It is essential to consider that these data transfer comes with costs when designing the architectures. For example, transfer of the data between an EC2 instance and an S3 bucket within the same region is often free, but the transfer of data in between inter-region comes with charges.

11. What Is Amazon RDS, And What Database Engines Does It Support?

Amazon RDS (Relational Database Service) is a managed relational database service provided by AWS. It takes care of the essential hardware infrastructure and supports multiple database engines such as MySQL, SQL Server, Oracle, PostgreSQL, and MariaDB. RDS simplifies database administration by automating tasks like backups, software patching, and scaling. This allows developers to focus on building and optimizing application logic instead of managing database infrastructure.

12. Explain The Concept Of AWS Identity And Access Management (IAM).

IAM stands for Identity Access Management, a security AWS service that provides Authentication and Authorization to AWS services and resources. It involves in creating users, assigning permissions through policies, and then setting up the multi-factor authentication. For example, IAM will grant read-only access for specific users to the S3 buckets or full administrative access to EC2 instances.

13. What Is Amazon VPC And How Does It Help In Securing Your Resources?

Amazon VPC ( Virutal Private Cloud ) is an AWS service that helps the users to create isolated networks within AWS account through customizing IP address ranges and the defining their subnets. It helps in enhancing the security through controlling both the inbound and outbound of the traffic. For example, To host the web servers in public subnets and connecting to the databases placing in private subnets can be on configuring the VPC. It provides an additional layer of network security to the applications.

14. How Many Subnets Can a VPC Contain?

By default a VPC can have up to 200 subnets.

15. Describe The Use Of Amazon Route 53.

Amazon Route 53 is an aws service that offers DNS web services which are scalable. It helps in guaranteeing dependable , low-latency routing to the AWS services through facilitating efficient translation of user-friendly domain names into IP addresses. For example, Route 53 will be useful to route the traffic between multiple EC2 instances or direct users to a hosted website on an S3 bucket.

16. How Does AWS Handle Disaster Recovery And Backup?

AWS comes up with various services for disaster recovery and backup. Amazon S3 service is the most perferable service for backup storage and centralized management. Additionally it supports in business continuity in the event of a disaster by replicating AWS workloads to on-premises.

17. What Is AWS Elastic Beanstalk, And How Does It Simplify Application Deployment?

AWS Elastic Beanstalk is a AWS managed service helps in providing simplified application's deployment and management through automatically handling the infrastructure provision. It allows the developers to focus completely on writing the code. For example, you only need to upload your code for deploying web application , Elastic Beanstalk will care of the rest of underlying infrastructures provisioning of EC2 instances and load balancing.

18. Explain The Significance Of AWS Organizations In Managing Multiple AWS Accounts.

AWS Organizations manages multiple AWS accounts on centralizing them. It organizing the billing, applying consistent policies across the accounts, and facilitates sharing of resources. For instance, you can use Organizations to implement a policy that provides the specific security settings across all accounts, safe guarding a unified and secure AWS environment.

19. What is An AMI In AWS and Why Is It Used?

An AMI (Amazon Machine Image) is like a blueprint used to create virtual computers (called EC2 instances) in AWS. It includes the operating system (such as Linux or Windows), any pre-installed software or applications, and configuration settings like storage and permissions. With the help of AMIs, we can easily launch new servers that have the exact setup we need.

Suppose you are setting up a new computer. You would need to install an operating system (like Windows or Linux), add software (such as Python, Java, or a web server), and configure all the necessary settings. This process takes time and effort. But with an AMI, this becomes much easier. Instead of repeating the same setup every time, you can save your configured environment as an AMI. Later, when you need a new machine, you can use the AMI to launch it in just a few clicks — fully ready to use.

20. What Is The Relationship Between Regions And Availability Zones in AWS?

AWS Regions are geographical areas, like cities or countries (for example, Mumbai or London). Inside each Region, there are smaller parts called Availability Zones (AZs).

An Availability Zone are data centers present in each AWS Region.

21. What Is The Maximum Size Of An Object In S3?

The maximum object size in Amazon S3 (Simple Storage Service) is 5 terabytes (5 TB).

Intermediate AWS Interview Questions

AWS Interview Questions

22. Describe The Difference Between Amazon S3 And EBS.

Amazon S3 is object storage for scalable of data accessing through internet, while EBS is block-level storage that is attached to the EC2 instances for persistent and high-performance of storage. S3 is ideal service for storing and retrieving for large amounts of unstructured data such as images and backups. On the other hand EBS is better suitable for databases which are requiring consistent and low-latency performance.

23. How Does AWS Lambda Work, And What Are Its Use Cases?

AWS Lambda is a serverless Event driven computing service that will execute code as a response to the events. Developers will upload the functions and Lambda are automatically scales and manages the infrastructure through event triggers or manual run. Use cases of Lambda service includes in real-time file processing, data transformation, and event-driven microservices, where you pay only for the consumed compute time i.e., Pay as per you Run

24. What Are Security Groups And NACLs In The Context Of AWS VPC?

Security groups are stateful firewalls acted at the instance level controlling the inbound and outbound traffic whereas Network Access Control Lists (NACLs) are stateless firewalls acted at the subnet level can be considered NACLs as external security layer and Security groups as internal security layer to the instances. While security groups are more straightforward and allow modification of rules easy, NACLs offer granular control at the subnet level with numbered rules.

25. Explain The Purpose Of AWS CloudFormation.

AWS CloudFormation is an Infrastructure as Code (IaC) service that helps in allowing the users to declaratively define and provide the availability of AWS infrastructure. It helps in simplifying the resource management, enabling the creation and updates of the stacks of AWS resources. This gurantee the consistency across the environments and facilitates the version-controlled infrastructure.

26. How Do You Monitor And Log AWS Resources?

AWS comes up with providing services such as CloudWatch for monitoring and CloudTrail for logging. CloudWatch take place in monitoring the resources and applications, while CloudTrail will record the API calls, providing the visibility of user activity. These tools collectively allow detailed observation and analysis of AWS resources.

27. Discuss The Various Storage Classes In Amazon S3.

Amazon S3 offers storage classes with different types as per needs. Standard storage class type provides low-latency access, Intelligent-Tiering provides optimization of costs by moving data between access tiers, Glacier is designed for archival purposes, offering retrieval times that span from minutes to hours, and finally the Glacier Deep Archive class type offers lowest cost for long-term archival.

28. What Is AWS OpsWorks, And How Does It Work?

AWS OpsWorks is a configuration management service that helps in deployment and management of the application. It generally uses Chef or Puppet for the automation purpose, allowing the users to define architecture of the application, configuration of the resource and deployment of the application. OpsWorks streamline the management of infrastructure, particularly for the complex applications.

29. Explain AWS Key Management Service (KMS) And Its Use Cases.

AWS Key Management Service (KMS) is a managed aws service that helps in creation and providing controll over encryption keys. It helps in integration with other AWS services to encrypt data that are at rest and then transitmitting in. Use cases of KMS include such as securing sensitive data, fulfillment of regulatory meetings, and managment of the access to encrypted resources.

30. How Does AWS Support Hybrid Cloud Architectures?

AWS supports hybrid cloud architectures through the services such as AWS Direct Connect, VPN, and AWS Outposts. Direct Connect service helps in establishing a dedicated network connection, VPN helps in enabling the secure communication over the internet, and finally Outposts service helps in expansion of AWS infrastructure to on-premises data centers on providing a seamless hybrid solution.

31. What Is The Significance Of Amazon DynamoDB In AWS?

Amazon DynamoDB is a service in AWS that is helpful in management of NoSQL database service that known for its scalability and low-latency performance. This service is suitable for the applications which requires seamlessly quick access to data, such as gaming, e-commerce, and mobile applications offering consistency of a single-digit millisecond latency.

32. What Is AWS Elastic Transcoder, And When Would You Use It?

AWS Elastic Transcoder is a AWS service that is useful for scalable media transcoding in conversion of media files into various formats. It is quite useful when their is a need to deliver the content in different resolutions, bit rates, or formats for various types of devices, such as video streaming for different platforms.

33. Discuss The Use Of AWS CodeDeploy In Application Deployment.

AWS CodeDeploy is a service that is useful in automation of code deployment to the instances, facilitating rapid and reliable application updates. It supports various deployment strategies allowing users to roll out the updates gradually or all at once. CodeDeploy works seamlessly with the services such as EC2 instances, on-premises servers, and Lambda functions.

34. Explain The Purpose Of AWS CloudTrail.

AWS CloudTrail is a service that helps in recording the API calls and providing a detailed history of actions taking part in the AWS account. It enhances the features such as security, compliance, and the operational troubleshootings by offering visibility into the user activity, allowing organizations to track the changes and monitor the resource utilization effectively.

35. How Do You Configure And Manage AWS Elastic Load Balancers?

AWS Elastic Load Balancers(ELB) is a service that helps in distribution of incoming traffic of the applications across multiple targets. This Configuration involves in setting up the listeners, defining target groups, and configuring the routing rules. Health checks helps in ensuring the efficient traffic distribution by enhancing fault tolerance and improving availability of the application.

36. What Is The AWS Marketplace, And How Is It Beneficial For Users?

The AWS Marketplace is a digital catalog service provided by AWS that offers a variety of third-party software services that are easy deployable on top of AWS. It benefits the users providing through a wide range of pre-configured solutions, and simplified software licensing and billing.

37. What Is The Difference Between Application Load Balancer and Network Load Balancer?

The following are the key differences between Application Load Balancer and Network Load Balancer:

FeatureApplication Load Balancer (ALB)Network Load Balancer (NLB)
OSI LayerOperates at Layer 7 (Application Layer)Operates at Layer 4 (Transport Layer)
Protocols SupportedHTTP, HTTPSTCP, TLS, UDP
Routing MechanismContent-based routing (e.g., host-based, path-based)Routes based on IP address and port
Static IP SupportDoes not support static IP addressesSupports static IP addresses and Elastic IPs
SSL TerminationSupports SSL/TLS terminationSupports SSL/TLS termination
WebSocket SupportSupports WebSocket and HTTP/2 protocolsDoes not support WebSocket
PerformanceDesigned for high flexibility and advanced routing featuresOptimized for high throughput and low latency, capable of handling millions of requests per second
Use CasesIdeal for web applications requiring advanced request routing, microservices architectures, and containerized applicationsSuitable for applications needing extreme performance, static IP addresses, or handling volatile traffic patterns, such as high-performance computing (HPC) and Internet of Things (IoT) applications
Integration with AWS ServicesIntegrates with AWS services like ECS, EKS, and supports Lambda functions as targetsCan integrate with ALB to combine benefits; supports PrivateLink with VPC Endpoints Service integration

38. What Is The Difference Between Vertical and Horizontal Scaling in AWS?

Vertical scaling refers to increasing the capacity of a single virtual machine like upgrading its CPU, RAM, or storage.
Horizontal scaling means adding more virtual machines to share the load, instead of relying on just one machine. This helps distribute CPU, RAM, and storage usage across multiple instances.

Advanced AWS Interview Questions

39. Discuss The Use Of Amazon ECS (Elastic Container Service) In Container Management.

Amazon ECS is a aws service helps with simplified container management by providing easy access to users to run and scale containerized applications. To improve the functionality it works with integration of other AWS services such as Elastic Load Balancing and CloudWatch. ECS supports both Fargate and EC2 instances services for better control over the underlying infrastructure.

40. Explain The Concept Of AWS Direct Connect.

AWS Direct Connect is an AWS service that helps in establishing direct network between on-premises and AWS Data centers. In compared to internet based connections it comes with providing better reliable and consistent network. For large data transfers, sensitive workloads, and the scenarios where requires low-latency connections to AWS resources usage of Direct Connect is preferable.

41. How Do You Troubleshoot Performance Issues In an AWS Environment?

Troubleshooting AWS performance issues deals in analyzing metrics of CloudWatch, Examining logs, and using of AWS X-Ray service for tracing. Additionally, It is essential to understand the architecture and dependencies of the application for identifying difficulties and optimizing the resource configurations. AWS provides a extensive set of tools to identify and resolve performance challenges.

42. What Is AWS Snowball, And When Would You Use It?

AWS Snowball is an AWS serive that provides a physical data transport of large amount of data in and out of AWS. It is helpful in the cases where the network bandwidth is limited and petabytes of data to be transfered over the internet for reducing the time delay. Snowball devices are shipped to the user, and data is safely moved to AWS, reducing data transfer times significantly.

43. How Does AWS Support DevOps Practices?

AWS supports DevOps practices by facilitating a variety of services for CI/CD workflow such as AWS CodePipeline, AWS CodeBuild, and AWS CodeDeploy. Inaddition to this IaC tools such as AWS CloudFormation helps in automating provision of resources. AWS facilitates integration with popular DevOps tools for providing collaboration between development and operations teams.

44. Discuss The Use of AWS CloudWatch In Monitoring Resources.

AWS CloudWatch helps in real time monitoring of AWS resources and applications. It collects and tracks metrics, sets alarms, and automatically responds to changes in resource utilization. CloudWatch Logs provides centralized log management on utilizing proactive monitoring, troubleshooting ensuring the optimal performance of AWS resources.

45. How Do you handle version control in Amazon S3?

Versioning in Amazon S3 allows users to preserve, retrieve, and restore every version of every object that are stored in a bucket. It is useful for the needs such as data protection, rollback, and audit trail. When the versioning of S3 is enabled, it automatically saves all versions of an item providing a detailed version history that can be managable via the API or AWS Management Console.

46. What Is AWS Glue, And How Does It Simplify The ETL Process?

AWS Glue is an entierly management of ETL services that extract , transform and load the services. It helps in automating the analysis process through streamlining the preparing and loading of data. Glue faciliates it gathered the data through discovers, catalogs and transforms data from various sources, simplifying the ETL workflow. It has ability to handle both structured and semi-structured data that making it to stand out as a powerful tool for data integration and analysis.

47. Explain The Concept Of AWS Step Functions.

AWS Step Functions is a serverless orchestration service in AWS that brings the coordination of multiple AWS services to work efficiently into serverless workflows It faciliates the users for designing and executing the workflows using visual workflows, simplifying complex transition states and error handlings . Step Functions are useful for devloping scalable and resilient applications.

48. Discuss The Benefits Of Using Amazon CloudFront.

Amazon CloudFront is a content delivery network (CDN) service in AWS that speed up the delivery of web content using AWS Global network Infrasture. It enhances the performance, security, and scalability of applications and websites by caching and delivering content from edge locations worldwide. CloudFront also provides additional features including DDoS protection and connecting with other AWS services

49. How Does AWS Handle Security In a Multi-Tenant Environment?

AWS comes up on utilizing a strong shared responsible architecture that gurantee security in an environment including physical infrastructure with serveral tenants. While customers has to handle managing the security in the cloud, protecting their data, applications, and access restrictions. Multi-tenant setups the benefit from enhancing security with inclusion features such as VPC isolation, IAM, encryption, and auditing.

50. What Is Amazon Kinesis, And How Is It Used For Real-Time Data Streaming?

Amazon Kinesis is suitable of services which are looking for real-time data streaming. Streaming data ingestion, processing, and analysis are made easier using Kinesis Data Streams, Data Firehose, and Data Analytics. It is useful for benefiting the applications which need real-time analytics, such as monitoring, fraud detection.

51. What Are The Key Considerations For Designing Highly Available Architectures In AWS?

Designing highly available architectures in AWS involves in distribution of workloads across multiple Availability Zones (AZs), using Auto Scaling services for dynamic allocation of resources and implementations of redundant and fault-tolerant components. Aside from data replication and load balancing , other factors are also come into account such as utilization management of services that inherently offering high availability , resilience safegaurding against the failures.

52. Describe a VPC Peering Scenario And Its Implementations.

AWS comes up with a shared responsibility model , In where AWS will take care the management of cloud Infrastructure and the customers are responsible for securing the applications data within the environment of cloud. AWS assist in providing many compliance certifications and tools such as AWS Artifact for collecting compliance reports. Customers can enhance the security of the application data by implementing security measures such as encryption , access control and audit trails safeguarding compliance with regulatory standards.

53. What Are the Different Types Of EC2 Instances Based On Their Costs?

There are three types of EC2 instances available by AWS:

  • On-demand Instance: It is good for short time or unpredictable workloads because you have to pay only for the time when you are using it with no long-term commitment.
  • Reserved Instances: If you are planing to use for 1 or 3 years reserved instances are best choice. It offers you lower prices and best for long term use.
  • Spot Instances: Spot Instances are unused EC2 instances available at a cheaper price, but they can be taken back by AWS at any time, so they are best for flexible or non-critical tasks.

54. Which Type Of Scaling Would You Recommend For RDS And Why?

Vertical Scaling is the best option for RDS because it is simple and you can easily upgrade your instance size to get more CPU, memory or storage according to your need. The major performance issues in RDS are caused due to resource limits, so scaling up solves this issue. . A database can only be scaled vertically, and there are 18 different instances in which you can resize the RDS. On the other hand, horizontal scaling is good for replicas. For more advanced scaling, Amazon Aurora offers better options with auto-scaling and clustering.

Scenario Based AWS Interview Questions

55. You Are Tasked With Designing A Scalable And Fault-Tolerant Web Application On AWS. How Would You Approach This?

To design a scalable and fault-tolerant web app on AWS, I’d use a multi-layered approach with redundancy and load distribution across AWS services and Availability Zones (AZs):

Compute Layer:

  • Use Amazon EC2 instances in an Auto Scaling Group (ASG) across multiple AZs for fault tolerance.
  • Implement Elastic Load Balancing (ELB) to evenly distribute traffic to healthy EC2 instances.

Data Layer:

  • Use Amazon RDS Multi-AZ for automatic failover, or consider Amazon Aurora for scalability and availability.
  • Use DynamoDB for NoSQL data with built-in scalability.
  • Back up data regularly using AWS Backup and store it in Amazon S3.

Storage Layer:

  • Store static assets (images, CSS, etc.) in Amazon S3 for durability.
  • Use CloudFront CDN to cache and reduce latency for assets globally.

Networking Layer:

  • Deploy resources in a VPC with public/private subnets.
  • Use NACLs and Security Groups for traffic control.
  • Manage DNS with Route 53, using health checks to ensure traffic goes to healthy endpoints.

Monitoring and Alerting:

  • Monitor metrics with Amazon CloudWatch and set up alarms for automated scaling or alerts.
  • Use AWS CloudTrail to audit API calls and resource changes.

Deployment and Automation:

  • Use AWS CloudFormation or CDK for Infrastructure as Code (IaC) to automate setup.
  • Set up CI/CD pipelines with AWS CodePipeline and CodeDeploy for smooth app updates.

56. Describe A Scenario Where You Would Choose Amazon RDS Over DynamoDB For a Database Solution.

Amazon RDS is preferable when their is a need of relational data model, dealing with complex queries or transactions are crucial. It will be suitable choice if the application is looking for flexibility in schema design for handling SQL queries. On the other hand, DynamoDB is best suited for NoSQL usecases such as real-time applications and gaming on handling low-latency requirements with simple queries.

57. Walk Through The Steps To Set Up a VPC With Public And Private Subnets.

In order to set up a AWS VPC, the CIDR block needs to be defined, subnets must be created, route tables should be configured, and NAT and internet gateways need to be set up. A route table needs to be linked to the internet gateway for public subnets, and a NAT gateway should be used for private subnets' traffic routing. Accordingly, network ACLs and security groups have to be defined. To guarantee the connectivity, configure VPN or VPC peering connections. This configuration permits controlled access while securely isolating resources.

58. Explain How You Would Handle a Sudden Increase In Traffic To Your Application Using AWS Services.

Auto Scaling is necessary for automatically adjusting utilization of resources based on demand in order to handle a sudden increase in traffic. Try using CloudFront service for content delivery, Amazon RDS or DynamoDB for scalable databases, and Elastic Load Balancing for the distribution of traffic. Utilizing services such as ElastiCache for caching minimizes the demand on backend resources. Route 53 or Global Accelerator services helps in improving the availability using AWS global Infrastructure. Scaling responses can be automated via AWS Lambda functions and CloudWatch alarms, providing a flawless user experience.

59. A Company Wants To Migrate Its On-Premises Servers To AWS. Outline The Steps Involved In This Migration Process.

Examining workloads on-premises and selecting the best migration approach such as lift-and-shift, re-platforming, or re-architecting, and establishing the target architecture on AWS are all crucial steps in the migration process. For a seamless transition of workloads, make use of services like AWS Server Migration Service (SMS) or Database Migration Service (DMS). Following migration, optimize resources, perform DNS record updates, and implement continuous monitoring. To guarantee a successful migration, consider accounting security measures like encryption and Virtual Private Cloud (VPC) setups.

60. How Would You Design A Disaster Recovery Plan For a Critical Application Hosted On AWS?

In order to design a disaster recovery plan, creating backups across the regions on replication of important data implementing cross-regions must be implemented. Definition of recovery time objectives (RTO) and recovery point objectives (RPO) must be specified. For the automation of cross-region replication try on using the services like AWS Backup for centralized backup management and AWS Elastic Disaster Recovery (EDR) for automating cross-region replication. Regularly test the plan with services like AWS Disaster Recovery Testing (DRT) to safegaurding the readiness.

61. Discuss A Scenario Where You Would Use AWS Lambda Functions In An Application.

AWS Lambda functions are ideal for scenarios that requires serverless, event-driven architecture. It works with principle of Pay as per Run coming to billing section. For example, in a photo-sharing application, Lambda functions can be triggered whenever users uploaded the images. These functions helps in resize the images, update the metadata in DynamoDB, and send the notifications. Lambda's stateless nature and automatic scaling make it efficient for handling variable workloads without need of manual management of underlying infrastructure.

62. You're Dealing With Sensitive Data, And The Client Requires End-To-End Encryption. How Would You Implement This In AWS?

Implementing end-to-end encryption involves with usage of services such as AWS Key Management Service (KMS) to manage encryption keys. Encrypt data at rest using S3 server-side encryption or RDS encryption. For data in transit, use HTTPS and SSL/TLS protocols. Implement encryption in Lambda functions, EC2 instances, and other services as needed. Strictly manage IAM roles and policies to control access to encryption keys and ensure a secure end-to-end encryption solution.

63. Describe a Situation Where You Would Use AWS Elastic Beanstalk And Its Advantages In That Context.

AWS Elastic Beanstalk is effective in situations in which quick deployment and administration of applications are essential. For instance, Elastic Beanstalk facilitates capacity provisioning, load balancing, and automatic scaling, which streamlines the deployment of web applications. It is a preferable option for faster deployment because of its benefits, which include simple application upgrades, monitoring integration with CloudWatch, and a variety of supported programming languages.

64. A Company Is Facing High Costs In Its AWS Environment. How Would You Analyze And Optimize The Costs?

Using AWS Expense Explorer service to identify expense drivers, AWS Budgets for setting cost thresholds, and Trusted Advisor and other tools to generate cost-saving recommendations are all part of the process of cost analysis and optimization. In order to match resources with demand, use auto-scaling, analyze the instance spots for variable workloads, and use reserved instances for dependable workloads. Reevaluate on usage of serverless options such as Lambda and keep checking on unused resources. Cost-effective resource allocation should be reviewed and modified on a regular basis.

65. How Can You Recover/Login To An EC2 Instance For Which You Have Lost The Key?

You can recover/login to an EC2 instance by using SystemManager by the following steps:

1. Set up AWS Systems Manager on your EC2 instance. To do that, install the SSM agent and attach a role that gives the instance permission to use Systems Manager.

2. Next, go to the Systems Manager Console and run the automation called AWSSupport-ResetAccess. This will create a new key pair and save the private key in Parameter Store.

3. After it finishes, go to Parameter Store, copy the private key, and delete it from there to keep things secure. Save the key as a .pem file and use it to connect to your instance using SSH.

This method works for both Linux and Windows EC2 instances.

66. VPC Is Not Resolving The Server Through DNS. What Might Be The Issue, And How Can You Fix It?

To fix this issue,you need to enable the DNS hostname resolution, by this the problem will resolve by itself.

67. Can You Describe The Process Of Setting Up A Continuous Delivery Pipeline In AWS Using CodePipeline And CodeBuild?

To set up a continuous delivery pipeline in AWS, you can use AWS CodePipeline along with CodeBuild by the following way:

  • First, push your source code to a repository like GitHub or AWS CodeCommit.
  • Then, create a CodeBuild project to define how your code should be built and tested.
  • After that, set up a CodePipeline, where you define stages like Source, Build, and Deploy.
  • In the Source stage, connect your repo
  • In the Build stage, link your CodeBuild project;
  • In the Deploy stage, choose a service like Elastic Beanstalk, ECS, or S3 for deployment.
  • Once set up, every time you push new code, the pipeline automatically builds, tests, and deploys your app, enabling smooth and automated delivery.

AWS ALL QS

 1. What is AWS?

AWS (Amazon Web Services) is a cloud computing platform that provides on-demand services such as compute, storage, databases, networking, and AI on a pay-as-you-go basis.

---

 2. What are the core services provided by AWS?

 Compute (EC2, Lambda, ECS)

 Storage (S3, EBS, Glacier)

 Database (RDS, DynamoDB, Aurora)

 Networking (VPC, Route 53, ELB)

 Security (IAM, KMS, Shield)

 Monitoring (CloudWatch, CloudTrail)

---

 3. Explain the difference between IaaS, PaaS, and SaaS.

 IaaS (Infrastructure as a Service): Provides virtualized computing resources (e.g., EC2, VPC).

 PaaS (Platform as a Service): Provides managed platforms for application deployment (e.g., Elastic Beanstalk).

 SaaS (Software as a Service): Provides ready-to-use software over the internet (e.g., Gmail, Salesforce).

---

 4. What is EC2?

Amazon EC2 (Elastic Compute Cloud) is a scalable virtual server service in AWS that allows you to run applications in the cloud.

---

 5. What is S3 and what are its main features?

Amazon S3 (Simple Storage Service) is an object storage service.

Features:

 Unlimited storage

 99.999999999% (11 9’s) durability

 Versioning

 Lifecycle policies

 Different storage classes

---

 6. What is the purpose of an IAM role?

IAM Roles provide temporary permissions to entities like EC2, Lambda, or applications without embedding credentials.

---

 7. What is a VPC?

Amazon VPC (Virtual Private Cloud) is a logically isolated network where you can launch AWS resources securely.

---

 8. How do you secure a VPC?

 Use Security Groups and Network ACLs

 Enable VPC Flow Logs

 Use private subnets for sensitive resources

 Deploy VPN/Direct Connect for private connectivity

---

 9. What is the difference between public and private subnets?

 Public subnet: Resources accessible from the internet (via Internet Gateway).

 Private subnet: Resources not directly accessible from the internet (use NAT for outbound).

---

 10. Explain the concept of regions and availability zones.

 Region: Geographical area (e.g., us-east-1).

 Availability Zone (AZ): Physically separate datacenters within a region.

---

 11. What is a security group in AWS?

A virtual firewall that controls inbound and outbound traffic at the instance level.

---

 12. What is the purpose of Amazon RDS?

Amazon RDS (Relational Database Service) is a managed service for relational databases (MySQL, PostgreSQL, Oracle, SQL Server, Aurora).

---

 13. What is the difference between Amazon RDS and DynamoDB?

 RDS: Relational, SQL-based, structured schema.

 DynamoDB: NoSQL, key-value/document, highly scalable.

---

 14. How does AWS Lambda work?

AWS Lambda runs code in response to events (event-driven computing) without managing servers.

---

 15. What is CloudFront?

Amazon CloudFront is a CDN (Content Delivery Network) that caches and delivers content globally with low latency.

---

 16. What is the difference between EBS and EFS?

 EBS (Elastic Block Store): Block storage, attached to a single EC2 instance.

 EFS (Elastic File System): Shared file storage, scalable, accessible by multiple instances.

---

 17. What are the benefits of using AWS CloudFormation?

 Infrastructure as Code

 Automated deployments

 Version control for infrastructure

 Reusability via templates

---

 18. What is the AWS Free Tier?

A program that allows free usage of specific AWS services for 12 months (like 750 hrs EC2, 5GB S3, 750 hrs RDS).

---

 19. What is the role of the AWS Management Console?

A web-based GUI for managing AWS services.

---

 20. How do you monitor AWS services?

Using CloudWatch (metrics, alarms, dashboards) and CloudTrail (API logs).

---

 21. What is an AWS bucket policy?

A JSON-based policy attached to an S3 bucket to define permissions.

---

 22. What are tags in AWS?

Key-value pairs used for identifying and organizing resources (cost tracking, automation, management).

---

 23. What is Route 53?

A DNS web service that provides domain registration, routing, and health checks.

---

 24. How does Elastic Load Balancing work?

Distributes traffic across multiple targets (EC2, containers, Lambda) for scalability and fault tolerance.

---

 25. What is Auto Scaling?

Automatically adjusts the number of EC2 instances based on demand.

---

 26. What is the AWS Shared Responsibility Model?

 AWS manages security of the cloud (infrastructure).

 Customer manages security in the cloud (apps, data, IAM).

---

 27. What are AWS Regions and Availability Zones?

(Answered in Q10 – repeat with emphasis for interviewer)

---

 28. What is CloudWatch?

Monitoring and observability service for metrics, logs, and alarms.

---

 29. Explain what a key pair is in EC2.

A combination of public and private keys used for secure SSH/RDP access to EC2 instances.

---

 30. How do you upload files to S3?

 AWS Console

 AWS CLI (`aws s3 cp`)

 SDKs (Python Boto3, etc.)

---

 31. What is AWS Glacier?

Now called S3 Glacier, used for low-cost archival storage.

---

 32. What is a bastion host?

A secure EC2 instance in a public subnet used to access resources in a private subnet.

---

 33. What is the difference between a VPN and AWS Direct Connect?

 VPN: Secure internet-based connection.

 Direct Connect: Dedicated private connection between on-premise and AWS.

---

 34. What is the purpose of AWS CodePipeline?

A CI/CD service for automating build, test, and deployment.

---

 35. What is Amazon SNS?

A notification service for pub/sub messaging.

---

 36. What are the different storage classes in S3?

 Standard

 Standard-IA (Infrequent Access)

 One Zone-IA

 Glacier

 Glacier Deep Archive

 Intelligent-Tiering

---

 37. Explain AWS Elastic Beanstalk.

A PaaS service for deploying and managing applications without managing infrastructure.

---

 38. What is AWS Inspector?

An automated security assessment service for EC2 and applications.

---

 39. How do you perform backups in AWS?

 EBS snapshots

 RDS automated backups

 S3 versioning

 AWS Backup service

---

 40. What are the pricing models for AWS services?

 On-Demand

 Reserved Instances

 Spot Instances

 Savings Plans

---------------------------------------------------------------------------------

 1. How does AWS handle data replication?

AWS replicates data across Availability Zones to ensure durability and high availability.

Example:

 S3 replicates objects automatically across multiple AZs.

 RDS Multi-AZ creates a standby replica in another AZ.

---

 2. Explain the concept of Elasticity in AWS.

Elasticity means the ability to scale resources up or down automatically based on demand (e.g., Auto Scaling EC2 instances).

---

 3. What are the benefits of using AWS CloudFormation templates?

 Automates infrastructure deployment

 Version-controlled infrastructure as code

 Consistent environments

 Easy rollback on errors

---

 4. How can you ensure high availability in AWS?

 Deploy across multiple AZs/Regions

 Use ELB + Auto Scaling

 Enable RDS Multi-AZ

 Use Route 53 health checks

---

 5. Describe the AWS Well-Architected Framework.

It has 5 pillars:

1. Operational Excellence

2. Security

3. Reliability

4. Performance Efficiency

5. Cost Optimization

---

 6. What is the difference between AWS Lambda and EC2?

 Lambda: Serverless, event-driven, short-running tasks.

 EC2: Full control, runs long processes, manual scaling.

---

 7. What are the types of Elastic Load Balancers?

 Application Load Balancer (ALB): Layer 7, HTTP/HTTPS traffic.

 Network Load Balancer (NLB): Layer 4, TCP/UDP, high performance.

 Classic Load Balancer (CLB): Older, basic Layer 4/7.

 Gateway Load Balancer (GLB): Used for third-party appliances (firewalls).

---

 8. How does Amazon S3 versioning work?

When versioning is enabled, every object modification results in a new version, while older versions are preserved.

---

 9. Explain the role of Amazon CloudTrail.

CloudTrail records API calls made in AWS, used for auditing, compliance, and security analysis.

---

 10. What is AWS Kinesis and when would you use it?

AWS Kinesis is a real-time data streaming service, used for IoT, logs, analytics, and live monitoring


---

 11. How can you implement a multi-account architecture in AWS?

 Use AWS Organizations for centralized management.

 Apply Service Control Policies (SCPs).

 Enable Consolidated Billing.

---

 12. What is the purpose of AWS Organizations?

Centralized account management, consolidated billing, and applying policies across accounts.

---

 13. Explain the difference between NAT Gateway and NAT Instance.

 NAT Gateway: Managed, highly available, scales automatically.

 NAT Instance: EC2-based, manual management, less scalable.

---

 14. What is AWS Direct Connect and when would you use it?


A dedicated private connection between on-premises and AWS. Used when low latency and consistent network performance is required.

---

 15. How do you perform cost management in AWS? Use AWS Cost Explorer & Budgets

 Apply tags for cost allocation

 Use Savings Plans / Reserved Instances

 Monitor with Trusted Advisor

---

 16. What is AWS Systems Manager?

A management service for patching, configuration, and automating operational tasks across AWS resources.

---

 17. How do you secure data in transit in AWS?

 Use SSL/TLS for encryption

 Use AWS Certificate Manager (ACM)

 Enable VPN/Direct Connect encryption

---

 18. Explain the concept of API Gateway.

Amazon API Gateway is a fully managed service for creating, publishing, and managing APIs at scale.

---

 19. What are the differences between Amazon RDS and Aurora?

 RDS: Managed relational databases (MySQL, PostgreSQL, etc.).

 Aurora: AWS-optimized, MySQL/PostgreSQL compatible, 5x faster than RDS MySQL.

---

 20. How do you configure cross-region replication in S3?

Enable Cross-Region Replication (CRR) with a destination bucket in another region and apply proper IAM roles.

---

 21. What is AWS Step Functions?

A service that coordinates serverless workflows by defining steps and sequencing functions.

---

 22. Explain how to implement a CI/CD pipeline in AWS.

 CodeCommit (source control)

 CodeBuild (build/test)

 CodeDeploy (deployment)

 CodePipeline (orchestration)

---

 23. What is Amazon Elastic Kubernetes Service (EKS)?

A managed Kubernetes service to run containerized applications on AWS without managing control planes.

---

 24. What is the difference between scheduled and event-driven Lambda functions?

 Scheduled: Triggered by CloudWatch events (cron jobs).

 Event-driven: Triggered by S3, DynamoDB, API Gateway events.

---

 25. How do you handle stateful applications in AWS?

 Use EBS volumes, EFS, or RDS for persistence.

 For containers, use EKS with persistent storage.

---

 26. Explain how AWS DMS works.

AWS Database Migration Service migrates databases with minimal downtime, supporting homogeneous (MySQL → MySQL) and heterogeneous (Oracle → PostgreSQL) migrations.

---

 27. What are the considerations for choosing an instance type in EC2?

 Workload type (compute, memory, storage, GPU)

 Performance requirements

 Cost optimization

 Networking needs

---

 28. How can you implement disaster recovery in AWS?

 Backup & Restore

 Pilot Light

 Warm Standby

 Multi-site Active-Active

---

 29. What is AWS Config?

A service to track and audit resource configurations and compliance over time.

---

 30. What is the purpose of AWS Secrets Manager?

To store, rotate, and manage secrets (passwords, API keys, database credentials).

---

 31. How does AWS Batch work?

AWS Batch runs batch processing workloads efficiently by managing job scheduling and computing resources automatically.

---

 32. What are CloudFormation nested stacks?

A stack within another CloudFormation stack, used to reuse templates and manage complex infrastructure.

---

 33. Explain the use of Amazon Elasticsearch Service (now OpenSearch Service).

A managed service for search, logging, and analytics (used with ELK stack).

---

 34. What are the different types of Amazon RDS instance classes?

 Standard Classes (db.m5, db.m6g): Balanced compute and memory.

 Memory-optimized (db.r5, db.r6g): High memory workloads.

 Burstable (db.t3): Cost-effective, low workloads.

---

 35. How can you optimize costs in AWS?

 Right-size instances

 Use Reserved Instances or Savings Plans

 Enable Auto Scaling

 Use S3 lifecycle policies

---

 36. Describe the use cases for Amazon Redshift.

A data warehouse for big data analytics, BI, reporting, and data mining.

---

 37. What is AWS Global Accelerator?

A networking service that improves global application performance by routing traffic via AWS edge locations.

---

 38. How do you manage serverless applications in AWS?

 Use AWS SAM (Serverless Application Model)

 Monitor with CloudWatch

 Deploy with CodePipeline

---

 39. Explain the role of Amazon SQS.

Amazon SQS (Simple Queue Service) is a fully managed message queuing service used for decoupling applications.

---

 40. What is the AWS Backup service?

A centralized service to automate backups across AWS services (EBS, RDS, DynamoDB, EFS, Storage Gateway).

-----------------------------------

Experienced-Level AWS Interview Questions

-----------------------------------

 1. How would you design a multi-tier application architecture in AWS?

 Presentation layer (Web): Deployed on ALB + EC2 or CloudFront.

 Application layer: Auto Scaling group of EC2 or containers (ECS/EKS).

 Database layer: RDS Multi-AZ or Aurora.

 Security: VPC with public & private subnets, security groups, WAF.

---

 2. Explain the trade-offs between using AWS Lambda vs. containerized services.

 Lambda: Event-driven, low-cost, no infrastructure management, but limited execution time (15 mins).

 Containers (ECS/EKS): Long-running apps, greater control, higher cost, more operational effort.

---

 3. How do you implement security best practices in AWS?

 Use IAM least privilege

 Enable MFA

 Encrypt data at rest & in transit

 Enable CloudTrail, GuardDuty, Security Hub

 Use WAF & Shield for DDoS protection

---

 4. What is AWS Transit Gateway, and when would you use it?

Transit Gateway connects multiple VPCs and on-premises networks through a central hub, simplifying large network topologies.

---

 5. Describe how to architect for resilience in AWS.

 Deploy across multiple AZs/Regions

 Use Auto Scaling + ELB

 Store data in multi-AZ storage (S3, Aurora, DynamoDB)

 Use disaster recovery strategies

---

 6. Explain the concept of microservices and how AWS supports them.

Microservices = loosely coupled, independently deployable services.

AWS support:

 ECS/EKS for containers

 API Gateway + Lambda

 SQS/SNS/EventBridge for communication

 CloudWatch & X-Ray for monitoring

---

 7. How do you ensure compliance in AWS?

 Use AWS Artifact for compliance reports

 Enable CloudTrail & Config

 Apply IAM policies & SCPs

 Use Audit Manager for regulatory frameworks (HIPAA, PCI-DSS, etc.)

---

 8. What are the key considerations for migrating to AWS?

 Application dependency mapping

 Data transfer strategies (Snowball, DMS, Direct Connect)

 Security and compliance requirements

 Cost optimization planning

---

 9. How do you handle large-scale data processing in AWS?

 Kinesis or MSK for streaming

 EMR (Hadoop/Spark) for batch processing

 Glue for ETL

 Redshift for analytics

---

 10. What is Amazon SageMaker, and how can it be used?

A fully managed ML service to build, train, and deploy machine learning models at scale.

---

 11. Explain how AWS App Mesh works.

App Mesh provides service mesh functionality:

 Controls service-to-service communication

 Enables observability (metrics, logs, tracing)

 Improves reliability with retries, failover

---

 12. Describe the use of AWS Glue.

A serverless ETL service that discovers, prepares, and transforms data for analytics and machine learning.

---

 13. How can you implement service discovery in AWS?

 Use Route 53 Private Hosted Zones

 Cloud Map for naming services

 ECS/EKS internal service discovery

---

 14. What strategies can you use for database migration to AWS?

 Lift & Shift (using DMS)

 Re-platforming (e.g., Oracle → Aurora)

 Re-architecting (monolith → microservices + DynamoDB)

---

 15. Explain how to optimize Amazon RDS performance.

 Enable read replicas

 Use Aurora for high performance

 Optimize indexes & queries

 Use Provisioned IOPS storage

 Enable caching (ElastiCache)

---

 16. What is Amazon FSx, and when would you use it?

A fully managed file system:

 FSx for Windows: Windows workloads.

 FSx for Lustre: High-performance computing.

---

 17. Describe the importance of logging and monitoring in AWS.

 Ensures security, compliance, and troubleshooting.

 Tools: CloudWatch (metrics/logs), CloudTrail (API logs), X-Ray (tracing), GuardDuty (threat detection).

---

 18. How do you implement a secure API with AWS API Gateway?

 Use IAM, Cognito, or Lambda authorizers for authentication

 Enable WAF & throttling

 Enable SSL/TLS encryption

---

 19. What are the considerations for using serverless architectures?

 Cold starts impact latency

 Timeout limits (15 mins in Lambda)

 State management (must use DynamoDB, S3, etc.)

 Cost efficiency for burst workloads

---

 20. How do you troubleshoot performance issues in AWS?

 Use CloudWatch & X-Ray for metrics and tracing

 Check Auto Scaling configurations

 Monitor network bottlenecks (VPC Flow Logs)

 Optimize DB queries

---

 21. What is AWS Data Pipeline, and how is it used?

A data workflow orchestration service to move and transform data between S3, RDS, EMR, Redshift.

---

 22. Describe the best practices for deploying applications using AWS CloudFormation.

 Use nested stacks for modular design

 Enable rollback on failure

 Use parameterized templates

 Store in version control (Git)

---

 23. How do you manage secrets in a serverless architecture?

 Use AWS Secrets Manager

 Use SSM Parameter Store

 Never hardcode secrets in Lambda code

---

 24. What is the role of AWS WAF?

AWS Web Application Firewall protects applications from SQL injection, XSS, DDoS attacks.

---

 25. Explain how you would architect a global application in AWS.

 Deploy in multiple regions

 Use Route 53 latency-based routing

 Use CloudFront CDN

 Store data in Aurora Global Database / DynamoDB Global Tables

---

 26. What are the key performance indicators for AWS services?

 EC2: CPU, memory, network usage

 RDS: Latency, IOPS, connections

 S3: Request rate, errors

 Lambda: Invocation count, duration, errors

---

 27. How do you conduct a cost analysis for AWS services?

 Use AWS Cost Explorer

 Enable detailed billing reports

 Apply resource tags

 Analyze RI/Savings Plan utilization

---

 28. Describe a scenario where you would use AWS Step Functions.

For orchestrating workflows: e.g., image processing pipeline where Lambda → Rekognition → S3 → DynamoDB in sequence.

---

 29. What is Amazon Kinesis Data Firehose?

A service to capture, transform, and load real-time data streams into S3, Redshift, or Elasticsearch.

---

 30. How do you implement Continuous Deployment in AWS?

 Use CodeCommit + CodeBuild + CodeDeploy + CodePipeline

 Integrate with CloudFormation / Elastic Beanstalk

---

 31. What is AWS Service Catalog?

A service that allows organizations to create and manage approved resource templates for self-service deployment.

---

 32. Describe how to handle event-driven architecture in AWS.

 Use SNS/SQS/EventBridge for event communication

 Trigger Lambda functions for processing

 Ensure idempotency and retry policies

---

 33. Explain how to secure a serverless application.

 Use IAM least privilege for Lambda

 Store secrets in Secrets Manager

 Apply API Gateway authentication + WAF

 Enable logging with CloudWatch

---

 34. What are AWS PrivateLink and its use cases?

AWS PrivateLink allows private connectivity to services across VPCs without exposing data to the internet.

Use cases: secure SaaS integration, VPC-to-VPC connectivity.

---

 35. How do you optimize Lambda function performance?

 Increase memory allocation (also increases CPU)

 Use provisioned concurrency

 Minimize package size

 Reuse execution context

---

 36. What is AWS Control Tower?

A service to set up and govern multi-account AWS environments following AWS best practices.

---

 37. Explain the use of Amazon QuickSight.

A business intelligence (BI) service for creating dashboards and data visualizations from AWS and external data sources.

---

 38. How do you manage hybrid cloud environments with AWS?

 Use Direct Connect or VPN for connectivity

 Deploy Outposts for on-prem workloads

 Use Storage Gateway for hybrid storage

---

 39. What is Amazon Neptune?

A fully managed graph database service supporting Gremlin and SPARQL queries (used for social networks, fraud detection).

---

 40. How do you evaluate and improve the architecture of an AWS solution?

 Use the AWS Well-Architected Tool

 Run Trusted Advisor checks

 Analyze CloudWatch/Cost Explorer metrics

 Apply security audits with Inspector & Config




Thursday, 21 August 2025

Terraform

 Q1. What is Terraform?

Answer:

Terraform is an open-source Infrastructure as Code (IaC) tool developed by HashiCorp. It allows you to define infrastructure (cloud, on-prem, hybrid) using a declarative configuration language (HCL – HashiCorp Configuration Language).

---

 Q2. What are the advantages of Terraform?

Answer:

 Cloud-agnostic (works with AWS, Azure, GCP, etc.)

 Declarative & idempotent (same config → same result)

 Supports provisioning, scaling, and versioning of infrastructure

 State management with tracking of resources

 Large ecosystem (providers & modules)

---

 Q3. What is the difference between Terraform and Ansible?

Answer:

 Terraform: Declarative, used for provisioning infrastructure.

 Ansible: Procedural, used mainly for configuration management.

 Terraform handles infrastructure lifecycle, while Ansible handles software lifecycle.


---

 Q4. What is Terraform state?

Answer:

Terraform maintains a state file (`terraform.tfstate`) that records information about managed resources. It allows Terraform to know what already exists and what changes are needed.

---

 Q5. What are Terraform providers?

Answer:

Providers are plugins that allow Terraform to interact with APIs of different platforms (AWS, Azure, GCP, Kubernetes, Databases, etc.)

---

 Q6. What are Terraform modules?


Answer:

A module is a container for multiple Terraform resources used together. It promotes reusability and standardization.


 Root module (main project)

 Child modules (reusable components)

---

 Q7. What is the difference between `terraform apply` and `terraform plan`?

Answer:

 terraform plan → Shows execution plan (what changes will happen).

 terraform apply → Executes the plan and makes changes in infrastructure.


---

 Q8. How do you handle sensitive data in Terraform?

Answer:

 Use `sensitive = true` in variables.

 Store secrets in external tools (Vault, AWS Secrets Manager, Azure Key Vault).

 Never commit `.tfstate` files to version control.


---

 Q9. What are Terraform workspaces?

Answer:

Workspaces allow multiple state files for the same configuration.

E.g., `dev`, `qa`, `prod` environments using same code but different state.

---

 Q10. What is `terraform refresh` used for?

Answer:`terraform refresh` updates the state file with the real-world resource states without changing infrastructure.


---

 Q11. What are Terraform backends?

Answer:

Backends define where Terraform stores state data.

 Local backend → stores state file locally.

 Remote backend → stores in cloud (S3, Azure Blob, GCS) for team collaboration.

---

 Q12. How do you lock Terraform state?

Answer:

State locking prevents multiple users from running Terraform at the same time.

 AWS S3 + DynamoDB (lock table)

 Terraform Cloud

 Consul backend

---

 Q13. What are `provisioners` in Terraform?

Answer:

Provisioners allow you to execute scripts or actions on resources after creation.

E.g., `local-exec`, `remote-exec`.

👉 Best practice: avoid provisioners; use configuration tools (Ansible, Chef).


---

 Q14. How do you upgrade Terraform provider versions?

Answer:

 Specify version in `required_providers`.

 Run `terraform init -upgrade` to update.


---

 Q15. What is the difference between `terraform import` and `terraform taint`?

Answer:

 terraform import → Brings an existing resource under Terraform management.

 terraform taint → Marks a resource for recreation in the next apply.


---


 Q16. How do you manage dependencies between resources?


Answer:

Terraform auto-detects dependencies via references.

Explicit dependency can be defined using `depends_on`.


 Scenario-Based Questions

 Q17. You have one Terraform config but need multiple environments (dev, qa, prod). How do you handle it?

Answer:

 Use workspaces (`terraform workspace new dev`)

 Or use separate state files with variables for each environment

 Or use Terragrunt for environment orchestration


---

 Q18. What if someone accidentally deletes the Terraform state file?

Answer:

 If using remote backend (S3, Terraform Cloud) → state is safe.

 If using local backend → recover from version control or recreate state with `terraform import`.

---

 Q19. You ran `terraform apply` and it failed midway. What happens?

Answer:

Terraform performs incremental execution → resources created before the failure remain, others are not created. Next run resumes from current state.

---

 Q20. How do you roll back in Terraform?

Answer:

 Terraform doesn’t have rollback → instead you revert configuration to the previous version and run `terraform apply`.

 State snapshots (in remote backend) can also help revert.

---

 Q21. How do you ensure team collaboration in Terraform?

Answer:

 Use remote backend (S3, Terraform Cloud) with locking

 Version control (Git) for `.tf` files

 Enforce policies with Sentinel / OPA

---