Tuesday, June 22, 2021

AWS : EBS Volumes : Attach and Mount on EC2

https://devopscube.com/mount-ebs-volume-ec2-instance/

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html


  • lsblk
  • lsblk -f
  • df -h
  • less /etc/fstab


[ec2-user@ip-10-79-196-74 ~]$ lsblk

NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT

nvme0n1     259:0    0  150G  0 disk

├─nvme0n1p1 259:1    0    1M  0 part

└─nvme0n1p2 259:2    0  150G  0 part /

[ec2-user@ip-10-79-196-74 ~]$ lsblk -f

NAME        FSTYPE LABEL UUID                                 MOUNTPOINT

nvme0n1

├─nvme0n1p1

└─nvme0n1p2 xfs          77f1de26-38e6-4e1d-8a1e-baa1610669e6 /

[ec2-user@ip-10-79-196-74 ~]$ cat /etc/fstab


#

# /etc/fstab

# Created by anaconda on Mon Oct 28 17:51:10 2019

#

# Accessible filesystems, by reference, are maintained under '/dev/disk'

# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info

#

UUID=77f1de26-38e6-4e1d-8a1e-baa1610669e6 /                       xfs     defaults        0 0

[ec2-user@ip-10-79-196-74 ~]$ df -h

Filesystem      Size  Used Avail Use% Mounted on

devtmpfs         16G     0   16G   0% /dev

tmpfs            16G     0   16G   0% /dev/shm

tmpfs            16G   25M   16G   1% /run

tmpfs            16G     0   16G   0% /sys/fs/cgroup

/dev/nvme0n1p2  150G  6.5G  144G   5% /

tmpfs           3.1G     0  3.1G   0% /run/user/1000

[ec2-user@ip-10-79-196-74 ~]$

EFS : Mount Instructions are available

 Click attach. This opens a page with mount instructions for the EFS.


https://computingforgeeks.com/mount-aws-efs-file-system-on-ec2/




Check if a Package is installed on Linux or not

https://www.cyberciti.biz/faq/apt-get-list-packages-are-installed-on-ubuntu-linux/

https://www.2daygeek.com/find-out-if-package-is-installed-or-not-in-linux-unix/


#RHEL 6, RHEL7

yum list installed openssh


#RHEL 8

dnf list installed httpd


#Ubuntu

apt list -a pkgNameHere

apt list --installed

apt -qq list nano

Amazon Image : Default User

https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/connection-prereqs.html

  • Get the default user name for the AMI that you used to launch your instance:

    • For Amazon Linux 2 or the Amazon Linux AMI, the user name is ec2-user.

    • For a CentOS AMI, the user name is centos.

    • For a Debian AMI, the user name is admin.

    • For a Fedora AMI, the user name is ec2-user or fedora.

    • For a RHEL AMI, the user name is ec2-user or root.

    • For a SUSE AMI, the user name is ec2-user or root.

    • For an Ubuntu AMI, the user name is ubuntu.

    • Otherwise, if ec2-user and root don't work, check with the AMI provider.

How to make File Immutable in Linux : Even Root cannot delete : CHATTR : LSATTR

[root@ip-10-79-197-70 ec2-user]# sudo chattr +i -V backup/iptables.backup

chattr 1.42.9 (28-Dec-2013)

Flags of backup/iptables.backup set as ----i-----------

[root@ip-10-79-197-70 ec2-user]# sudo lsattr backup

----i----------- backup/iptables.backup

[root@ip-10-79-197-70 ec2-user]# rm -rf backup

rm: cannot remove ‘backup/iptables.backup’: Permission denied

[root@ip-10-79-197-70 ec2-user]# sudo rm -rf backup

rm: cannot remove ‘backup/iptables.backup’: Permission denied

[root@ip-10-79-197-70 ec2-user]# exit

exit

Redhat : IPTABLES : How to persist iptables as its changes are not saved by default

https://www.geeksforgeeks.org/iptables-restore-command-in-linux-with-examples/

https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/4/html/security_guide/s2-firewall-ipt-act-sav

7.2.2. SAVING AND RESTORING IPTABLES RULES

Firewall rules are only valid for the time the computer is on; so, if the system is rebooted, the rules are automatically flushed and reset. To save the rules so that they are loaded later, use the following command:
/sbin/service iptables save
The rules are stored in the file /etc/sysconfig/iptables and are applied whenever the service is started or restarted, including when the machine is rebooted.

AWS : EFS

https://docs.aws.amazon.com/efs/latest/ug/creating-using-create-fs.html#creating-using-fs-part1-console


https://docs.aws.amazon.com/efs/latest/ug/mounting-fs.html

The EFS mount helper is part of the amazon-efs-utils package. The amazon-efs-utils package is an open-source collection of Amazon EFS tools. For more information, see Manually installing the Amazon EFS client.


Before the Amazon EFS mount helper was available, we recommended mounting your Amazon EFS file systems using the standard Linux NFS client. For more information, see Mounting file systems without the EFS mount helper.



https://aws.amazon.com/efs/pricing/

Azure - Pipeline - Add Approver for Stage

https://learn.microsoft.com/en-us/azure/devops/pipelines/process/approvals?view=azure-devops&tabs=check-pass