It looks like you're outlining the correct steps to install Docker on an Amazon EC2 instance running Amazon Linux. Here's a concise summary of the process, including some clarifications:
Manual Installation Steps (If Not Using a Script) You can also run the commands manually:
sudo yum autoremove docker -y
sudo yum install docker -y
sudo service docker start
sudo usermod -aG docker ec2-user
sudo systemctl enable docker
docker --version
Important Note After running the usermod command, you will need to log out of the EC2 instance and log back in for the group changes to take effect. This is crucial because it allows the ec2-user to run Docker commands without sudo.