Upgrade & Secure Your Future with DevOps, SRE, DevSecOps, MLOps!
We spend hours on Instagram and YouTube and waste money on coffee and fast food, but wonβt spend 30 minutes a day learning skills to boost our careers.
Master in DevOps, SRE, DevSecOps & MLOps!
Learn from Guru Rajesh Kumar and double your salary in just one year.
Write a terraform script where you create a linux ec2 instance with Security group and key defined so you should be able to use key to login to ec2 instance
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "~> 3.0"
}
github = {
source = "integrations/github"
version = "~> 4.0"
}
}
}
provider "aws" {
region = "us-west-2"
access_key = "AKIAYIMEDZZZKEPKRNEM"
secret_key = "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"
}
resource "aws_instance" "first-ec2" {
ami = "ami-0dc8f589abe99f538" # us-west-2
instance_type = "t2.micro"
tags = {
Name = "Anusha"
}
}
resource "aws_security_group" "default" {
name = "rds_sg"
}
Write a comparison between Ansible Vs Docker Vs Terraform
Attribute | Terraform | Ansible |
Tool category | Orchestration | Configuration management |
Approach | Immutable infrastructure | Mutable infrastructure |
Language | Declarative | Imperative |
Provisioning | Specializes in infrastructure provisioning | Limited support for infrastructure provisioning |
LIfecycle management | Lifecycle aware. Maintains state of deployments. | No lifecycle awareness |
Command line operation | Yes | Yes |
Agentless | Yes | Yes |
- Ansible is a powerful server and a configuration management tool, while Docker gives more flexibility in terms of providing modern and innovative options. The outreach of DevOps has made giant strides and Kubernetes being one of the important tools that have provided for portability, extensions, and self-smart processes most importantly. Terraform is the easiest to understand.
- Docker is particularly a container technology while Ansible and Kubernetes are tools for configuration management.
- Ansible works with Python while Docker and Kubernetes work with Go.
- Also, while Ansible and Docker are very user-friendly and easy to manage Kubernetes needs a lot of preparations in terms of planning and manual installation.
- Docker has multi-components, while Ansible works well with front end developers. Moreover, Kubernetes is much more modern in its applications.
- Kubernetes thus remains a complex mechanism to work upon nonetheless very helpful however Docker is appealing in the way it handles most of the work.