Thursday, October 24, 2019

How to connect to an EC2 instance from local machine after creating EC2 in AWS?

Find the steps to connect to an EC2 instance from local machine after creating it in AWS.

Pre-requisites:

1. Keys(for e.g., yourkey.pem) already downloaded in your local machine, preferably in Downloads folder.
2. EC2 is up and running
3. For windows laptop, you need to install Git by downloading from this URL - https://git-scm.com/downloads
4. For apple desktop or laptops, download https://www.iterm2.com/downloads.html

Steps to connect to EC2 instance:

1. Go to AWS console.
2. Click on EC2, click on running instances link





3. Select the checkbox of EC2 you would like to connect to.
4. Click on Action. Copy the url from SSH which looks like below:
For e.g.
ssh -i "mykey.pem" ubuntu@dns_name.compute.amazonaws.com
 

5. Go to your local machine, Open Git bash, navigate to downloads directory like below:
For windows laptop --> cd downloads

steps For iMac only --> cd downloads
chmod 400 yourkey.pem

6. Paste the url from example highlighted above in step # 4.
ssh -i "mykey.pem" ubuntu@dns_name.compute.amazonaws.com
7. say yes when it is asking to connect.
8. now you should be in AWS cloud, screen should tell you something like this:

Last login: Sun Feb 18 19:01:21 2018 from 64.183.186.78
ubuntu@ip-172-31-26-96:~$
 
 

Wednesday, October 9, 2019

DevOps BootCamp by Coach AK on AWS and Azure Cloud Online Classes | March 2023 Schedule

Are you in IT? Tired of your work? Are you not able to make any good progress in your career? 
Are you not having a job? Looking for a break in IT? Are you interested in learning DevOps? 
 
Did you get laid off from your previous job due to Covid-19
 
You are in the right place to kick start your career in DevOps. DevOps is one of the top and hot IT skills right now. Currently almost all the employers are struggling to get right resources in their teams who can do the DevOps and automation work..You could be that person by attending this coaching program.

DevOps Coaching Classes schedules for March 2023(currently enrollment is going on)

DateTimeTypeWhen?
Mar 6th6:00 to 8:00 PM CSTWeekdaysMondays/Wednesdays
Mar 25th09:45 AM CST to 11:20 AM on Saturdays
10:30 AM CST to 12:30 PM CST on Sundays
WeekendsSat/Sundays

DevOps Coaching Highlights:

- Comprehensive hands on knowledge on Git, Jenkins, Maven, SonarQube, Nexus, Terraform, Ansible, Puppet, Docker, AWS IAM, ECR, Docker registry. AWS and Azure cloud platforms.

- Coach is having about 22+ yrs of professional IT experience, 8+ Yrs in DevOps/Cloud/Automation.

- Many students already got placed in reputed companies from this coaching program successfully.

- Working as a Sr.DevOps Coach/Architect in a one of the top IT services companies in USA.

- Unique program...less theory, more hands on lab exercises
 
Resume preparation will be done with candidates personally.

One-to-one Interview coaching.

- Coaching is purely hands on with 101% job relevant.

100% Job assistance.

- Coached about 1400+ students successfully for past five years and many of my students got placed with many large enterprises in DFW, Charlotte, Houston, Austin, Chicago, Florida, Seattle, Bay area, Ohio, NJ and NY areas..

To join DevOps Coaching classes, contact coach below:

Contact no # : +1(469)733-5248
Email id: devops.coaching@gmail.com
Contact: Coach AK

Friday, October 4, 2019

Docker Interview Questions - Popular Docker Interview Questions

Docker Interview Questions - Popular Docker Interview Questions

1. What is the difference between Docker image and Docker container?

Docker container is simply an instance of Docker image.
A Docker image is an immutable file, which is a snapshot of container. We create an image with build command. Docker image contains all your application code along with all the dependencies packaged into this snapshot.

When we use run command, an Image will produce a container.

In programming language, an Image is a Class and a Container is an instance of the class.

2.  Can we run multiple apps on one server with Docker?
Yes, theoretically we can run multiple apps on one Docker server. But in practice, it is better to run different components on separate containers.

With this we get cleaner environment and it can be used for multiple uses.

3. How does docker client communicates with Docker daemon?

Docker client or command line interface, communicated with Docker daemon through APIs. 

    4.     How to enable IPV6 in Docker
Edit /etc/docker/daemon.json and set the ipv6 key to true.
{
  "ipv6": true
}
Save the file.
Reload the Docker configuration file by executing the below command:
systemctl reload docker


   5. How to copy files inside Dockerfile?
     Use COPY command
     For e.g.,
COPY app.py /usr/src/app/

6. How do you see running container in Docker?
docker ps command

7. How do you see all the containers?
docker ps -a command will show all the containers..

8. How to create directory inside Dockerfile?
mkdir -p /var/www/app
or  
WORKDIR /var/www/app 

      9. What are the benefits of using Docker?
      Docker is a very powerful tool. Some of the main benefits of using Docker are as follows:
     
       I. Utilize Developer Skills : With Docker we maximize the use of Developer skills. With Docker  there is less need of build or
release engineers. Same Developer can create software and wrap it in one single file.
       II. Standard Application Image : Docker based system allows us to bundle the application software and Operating system files in a
single Application Image that can be deployed independently.

       III. Uniform deployment : With Docker we can create one package of our software and deploy it on different platforms seamlessl y
   
10. What happens when you stop the container? Will you loose the data?
You won’t lose any data when Docker container exits. Any data that your application writes to the container gets preserved on the disk until you explicitly delete the container. The file system for the container persists even after the container halts.

11. What is the difference between Docker stop and Docker kill commands?
The difference between ‘docker kill’ and ‘docker stop’ is that ‘docker stop’ gives the container time to shutdown gracefully, in situations when it is taking too much time for getting the container to stop, one can opt to kill it.

Tuesday, October 1, 2019

Jenkins Nexus Integration - How to integrate Sonatype Nexus with Jenkins - Upload artifacts from Jenkins to Nexus repository

You can install plug-in called Nexus Artifact Uploader plug-in to integrate Nexus with Jenkins. Let us see how to integrate Jenkins with Nexus and able to upload War/Ear/Jar/Exe/DLLs.













Pre-requisites:

Install Nexus Artifact Uploader plugin in Jenkins.


Steps:

1. Once you installed the above plug-ins, click existing FreeStyle job configuration or create a new job.

2. Under source code management. enter bitbucket repo url and git credentials.

3. Go to build section, add Maven targets. with goals clean install. Also click advance, give path of POM.xml



4. click on Add build step, choose Nexus artifact uploader.



5. Enter information per below screen shot.
Make sure you enter version as 1.0-SNAPSHOT and repository as maven-snapshots

6. Click on Apply, Save.



7. Now login to Nexus repo, Click on Components, Click on maven-snapshots


8. you shall see the WAR being uploaded here.


You can watch the above steps in detail in YouTube channel below:


How to setup SonaType Nexus 3 on Linux in EC2? Nexus installation on RedHat Linux | Install Nexus on RedHat Linux

Nexus is an open source, Java based binary repository manager, used for storing build artifacts. We will eventually integrate Nexus with Jenkins for uploading WAR/EAR/JAR files.

Here are the steps for installing Sonatype Nexus 3 in RHEL in EC2 on AWS. Please create a new Redhat EC2 instance with small type. Choose Redhat Enterprise 8.

Pre-requisites:
Make sure you open port 8081 in AWS security group

Installation Steps:

sudo yum install wget -y






Download Java 8
sudo yum install java-1.8.0-openjdk.x86_64 -y

you can confirm java is installed by typing the below command:
java -version

Execute the below command to navigate to /opt directory by changing directory:

cd /opt

Download Nexus Latest version

sudo wget -O nexus3.tar.gz https://download.sonatype.com/nexus/3/latest-unix.tar.gz

Extract Nexus
sudo tar -xvf nexus3.tar.gz
sudo mv nexus-3* nexus

Create a user called Nexus
sudo adduser nexus

Change the ownership of nexus files and nexus data directory to nexus user.
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work


Add Nexus as a user
sudo vi /opt/nexus/bin/nexus.rc
change as per above screenshot by removing # and adding nexus 
 
 
 
 

Modify memory settings in Nexus configuration file

sudo vi /opt/nexus/bin/nexus.vmoptions

Modify the above file as shown in below:

-Xms512m
-Xmx512m
-XX:MaxDirectMemorySize=512m
after making changes, press wq! to come out of the file.

Configure Nexus to run as a service

sudo vi /etc/systemd/system/nexus.service
Copy the below content highlighted in green color.

[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
User=nexus
Group=nexus
ExecStart=/opt/nexus/bin/nexus start
ExecStop=/opt/nexus/bin/nexus stop
User=nexus
Restart=on-abort
[Install]
WantedBy=multi-user.target


Create a link to Nexus
sudo ln -s /opt/nexus/bin/nexus /etc/init.d/nexus

Execute the following command to add nexus service to boot.

sudo chkconfig --add nexus
sudo chkconfig --levels 345 nexus on


Start Nexus
sudo service nexus start







Check whether Nexus service is running
sudo service nexus status


Check the logs to see if Nexus is running
tail -f /opt/sonatype-work/nexus3/log/nexus.log

You will see Nexus started..If you Nexus stopped, review the steps above. 
Now press Ctrl C to come out of this windows.

Once Nexus is successfully installed, you can access it in the browser by URL - http://public_dns_name:8081

Click on Sign in link
user name is admin and password can be found by executing below command:

sudo cat /opt/sonatype-work/nexus3/admin.password




Copy the password and click sign in.
Now setup admin password as admin123


You should see the home page of Nexus:



Please follow steps for integrating Nexus with Jenkins


Please watch my YouTube channel on demo on How to setup Nexus 3 on Red Hat Linux in AWS:


DevSecOps Bootcamp Dec 2024 Schedule | DevSecOps & AWS Azure Cloud Coaching by Coach AK | DevSecOps and Cloud Computing Online Classes

Lot of new topics covered like GitHub Actions, GitHub Advanced Security, Helm, Prometheus and Grafana..) The DevOps requirements in the IT m...