...
Download the AWS CLI:
Code Block language bash curl "<httpshttps://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip>zip" -o "awscliv2.zip"
Install unzip tool (if not already installed):
Code Block language bash sudo apt update sudo apt install unzip -y
Unzip the downloaded AWS CLI file:
Code Block language bash unzip awscliv2.zip
Install AWS CLI:
Code Block language bash sudo ./aws/install
Verify installation:
Code Block language bash aws --version
You should see the installed version, such as:
aws-cli/2.x.x
...
Download the latest stable version of
kubectl
:Code Block language bash curl -LO "<httpshttps://dl.k8s.io/release/$(curl>curl -L -s <httpshttps://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl>kubectl"
Install
kubectl
:Code Block language bash sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
Verify
kubectl
installation:Code Block language bash kubectl version --client
You should see the client version information.
Step
...
6: Create Ubuntu users
Create the ubuntu users with the same username as IAM user & provide necessary privileges.
Code Block | ||
---|---|---|
| ||
sudo useradd -m -s /bin/bash <username> # creates a new user
sudo visudo # edit sudoer file add below line to it, to restict
<username> ALL=(ALL) NOPASSWD: !ALL # password prompt when accessing sudo from other users
sudo mkdir /home/<username>/.ssh
sudo vi /home/<username>/.ssh/authorized_keys # add user's public key
sudo su - <username> |
Login to the user created and proceed
Step 7: (Optional) Configure AWS CLI
To configure AWS CLI with your credentials and default settings, run the following command:
...
AWS Access Key ID
AWS Secret Access Key
Default Region Name (e.g.,
ap-south-1
)Default Output Format (e.g.,
json
)
Step
...
8: Harden Security
Limit SSH Access:
Consider restricting port 22 access to specific trusted IP addresses for enhanced security, instead of allowing open access (
0.0.0.0/0
).
Install Security Updates:
Update all packages on the instance to the latest security patches:
Code Block language bash sudo apt update && sudo apt upgrade -y
...