Devops Interview
Devops Interview
VPCs
Subnets
S3 Buckets
RDS Instances
IAM Roles/Policies
You can specify these resources in .tf configuration files and run terraform
apply to create them.
Terraform Cloud/Enterprise
4. What are the security measures you take while storing the
state file in Git?
Storing state files in Git is not recommended, as they might contain sensitive
data. If needed:
Use .gitignore to prevent the state file from being added to the
repository.
If using a remote backend (e.g., S3), ensure that the state file is
encrypted using encryption mechanisms like server-side encryption.
Use IAM roles/policies for restricting access to the database and web
application.
13. 10 EC2 instances, 2 are down, how does the load balancer
know these 2 instances are down?
The Load Balancer regularly checks the health of registered instances using
health checks (e.g., HTTP, TCP). If an instance fails the health check, it is
removed from the load balancer's pool.
14. 2 EC2 are down, it should automatically get up. How to do it?
Use an Auto Scaling group, which automatically replaces unhealthy EC2
instances with new ones based on defined policies.
17. What security measures do you take while pushing the image
to registry or artifact?
Use private registries with authentication.
ec2 = boto3.client('ec2')
def create_snapshot(instance_id):
volumes = ec2.describe_instances(InstanceIds=[instance_id])
['Reservations'][0]['Instances'][0]['BlockDeviceMappings']
for volume in volumes:
snapshot = ec2.create_snapshot(VolumeId=volume['Ebs']
['VolumeId'], Description=f"Backup of {instance_id}")
print(f"Created snapshot {snapshot['SnapshotId']} for volume
{volume['Ebs']['VolumeId']}")
create_snapshot('i-0abcd1234efgh5678')
24. You are in master branch without coming out, how to create a
feature?
You can use git checkout -b feature-branch to create a new feature branch
from the current branch.
Windows: dir
If you need more detailed answers to any of these, feel free to ask!