Posts

Showing posts from March, 2023

Terraform - AWS Sync

Image
  In this post will see how to create a security group to allow ports 22 and 80. And how to modify the security group by adding port 443. # Creating a security group to allow access on port 80 and 22.data resource "aws_security_group" "webserver-sg" {     name = "webserver-sg"     description = "Allow HTTP and SSH traffic"     vpc_id = var . vpcid     ingress {         from_port = 80         to_port = 80         protocol = "tcp"         cidr_blocks = [ "0.0.0.0/0" ]     }     ingress {         from_port = 22         to_port = 22         protocol = "tcp"         cidr_blocks = [ "0.0.0.0/0" ]     }     egress {         from_port = 0         to_port = 0       ...

AWS Webserver - Application Load Balancer

Image
  We are going to set up an HTTP server load balancer. 1) 2x Ec2 Instances. 2) Target Group. 3) Application LB. We have 2 EC2 instances configured with httpd.  Next, Create a target group. Let's proceed with target registration. Let's proceed with creating an Application Load Balancer. Now both the hosts are healthy and its accessible via ALB FQDN.

Ansible Q&A

Image
  1) How to create an empty file with Ansible? To create an empty file, Ansible uses a file module. For this, we need to set up two parameters. Path - This place represents the location where the file gets created, either the relative or an absolute path. Also, the name of the file includes here. State - For creating a new file, this parameter should be set to touch. 2) How will you set the environment variable or any path for a task or entire playbook? To set the environment variables, we use the environment keyword. We'll use it at the task or other levels in the play: environment:   PATH: "{{ ansible_env.PATH }}:/thingy/bin"   SOME: value 3) How do you access Shell Environment Variables? Accessing the value of Home environment variable on the management machine: local_home:”{{lookup(‘env’,’HOME’)}}” 4) Is it possible to increase the Ansible reboot module to more than 600 seconds? Yes, it is possible to increase the Ansible reboot module to specific values using the bel...

Terraform Series - Q&A

Image
  1) Which of the following is not a valid variable type? list map item tuple object 2) Which of the following is not a valid data type? set tuple map list array 3) Which method has the highest priority in a variable declaration? terraform.tfvars variable definition file terraform.tfvars.json using .auto.tfvars command line flag of -var or -var-file 4) Which argument should be used to explicitly set dependencies for a resource? dependent resource_depend depend_on depends_on 5) How do we make use of implicit dependency? datasources reference expresssions variables depends_on 6) Which location is the terraform state file stored by default? /tmp Inside the configuration directory. /root/terraform-projects /root 7) Which option should we use to disable state? -state=false We cannot disable state -nostate -refresh=false 8)Which format is the state file stored in default? JSON XML TOML YAML 9) Which of the following commands does NOT refresh the state? terraform init terraform apply terr...

Terraform Series - AWS DynamoDB

Image
  Amazon DynamoDB is a fully managed proprietary NoSQL database service that supports key–value and document data structures and is offered by Amazon.com as part of the Amazon Web Services portfolio.  A table is a collection of items, and each item is a collection of attributes. DynamoDB uses primary keys to uniquely identify each item in a table and secondary indexes to provide more querying flexibility.  The following are the basic DynamoDB components: Tables – Similar to other database systems, DynamoDB stores data in tables. A table is a collection of data. Items – Each table contains zero or more items. An item is a group of attributes that is uniquely identifiable among all of the other items.  Attributes – Each item is composed of one or more attributes. An attribute is a fundamental data element, something that does not need to be broken down any furthe People table contains attributes called PersonID, LastName, FirstName. resource "aws_dynamodb_table" "car...