Check changes before pulling from remote git repository steps below:
fetch the changes from the remote
Shell
1
git fetch origin
show commit logs of changes
Shell
1
git log master..origin/master
show diffs of changes
Shell
1
git diffmaster..origin/master
apply the changes by merge..
Shell
1
git merge origin/master
Difference between Git Pull vs Git Fetch:
Git pull will download and merge latest changes from the remote repository automatically. You don’t have chance to review the changes and conflicts.
Git fetch will only download lastest changes but won’t merge. You can use git diff to review the changes and conflicts, then use git merge to merge the changes.
From AWS EC2 Management Console, click Instances, select the original instance (that you lose the private key)
Memo the detail information of the original instance:
the instance ID (i-xxxxxxxx), AMI ID (ami-xxxxxxxx), and Availability Zone of the original instance from the details pane.
volume ID in the EBS ID field (vol-xxxxxxxx) under Block devices the details pane.
[EC2-Classic] If the original instance has an associated Elastic IP address, write down the Elastic IP address shown under Elastic IP in the details pane.
Select the original instance to click stop.
Launch a new instance with same config as the original instance. You can tag the new instance as Name=Temporary and create a new key pair, download it.
Click Volumes in the navigation pane, select the root device volume for the original instance. Click Detach Volume to detach the volum. Wait for the state of the volume to become available. (You might need to click the Refresh icon.)
Atach the original instance’s root volume to the new instance and specify the device name (for example, /dev/sdf ) .
Use PuTTY to connect the new instance via SSH.
Mount the root device volume for the original instance to the new instance.
Use the lsblk command to determine if the volume is partitioned.
Shell
1
2
3
4
5
6
7
[ec2-user~]$lsblk
NAME MAJ:MIN RMSIZE RO TYPEMOUNTPOINT
xvda202:008G0disk
└─xvda1202:108G0part/
xvdf202:800101G0disk
└─xvdf1202:810101G0part
xvdg202:96030G0disk
In the above example, /dev/xvda and /dev/xvdf are partitioned volumes, and /dev/xvdg is not. If your volume is partitioned, you mount the partition (/dev/xvdf1) instead of the raw device (/dev/xvdf) in the next steps.
Create a temporary directory to mount the volume.
Shell
1
[ec2-user~]$sudo mkdir/mnt/tempvol
Mount the volume (or partition) at the temporary mount point, using the volume name or device name you identified earlier.
Shell
1
[ec2-user~]$sudo mount/dev/xvdf1/mnt/tempvol
Use the new instance’s authorized_keys to update the original instance‘s authorized_keys
If copy failed, please modify the file permission.
Unmount the /mnt/tempvol
Shell
1
[ec2-user~]$sudo umount/mnt/tempvol
So you can reattach it to the original instance again
From the Amazon EC2 Management Console, select the original instance’s volume, click Actions, and then click Detach Volume. Wait for the state of the volume to become available. (You might need to click the Refresh icon.)
Then select original instance’s volume, click Actions and click Attach Volume. Select the original instance ID, specify the device name that you memoed (for example, /dev/xvda), and then click Yes, Attach.
Select the original instance to start. After the instance’s state becomes running , you can connect to it using the private key file for your new key pair.
Charpter-1: How to install AWS EC2 t2.micro instance
Before installing wordpress on AWS EC2 t2.micro instance (server), we have to prepair an AWS EC2 instance.
In this article I will introduce how to install a free tier AWS EC2 t2.micro instance.
1. Choose an Amazon Machine Image (AMI)
Step1 of installing AWS EC2 t2.micro
We selected “Amazon Linux AMI 2014.09.2 (HVM) – ami” to install.
PS: There is another AIM “Amazon Linux AMI 2014.09.2 (PV) – ami“. PV type AMI has smaller memory and lower network performance than HVM type in free tier.
HMV vs PV AMI
2. Choose an Instance Type
Step2 of installing AWS EC2 t2.micro
Only t2.micro type is available for free tier.
3. Configure Instance Details
Step 3 Configure Instance Details
Use the default configure, then click “Next Add Storage”.
4. Add Storage
Step 4 Add Storage
Free tier eligible customers can get up to 30 GB of EBS General Purpose (SSD) or Magnetic storage.
5. Tag Instance
Step 5 Tag Instance
You could define a tag with key = Name and value = Webserver as you wish.
6. Configure Security Group
Step 6 Configure Security Group
In order to allow anyone access your website, please add HTTP rule as below
Add HTTP Rule
7. Review Instance Launch
Step 7 Review Instance Launch
If no problem, click “Launch”
Create a new key pair
Input a key pair name as you wish, then click “Download Key Pair” to download a pem file.
After downloading the pem file successfully, the button “Launch Instances” can be clicked now.
Launch Status
Now, we have already got a server ready to install wordpress.