fbpx Linux + AWS: Sysadmin Guide to EC2, IAM, S3, and CLI | Certificação Linux

Linux + AWS: The Sysadmin Guide to Working with EC2, IAM, and S3

📅 07/19/2026 ⏱ 4 min ✍️ Uira Ribeiro
Linux + AWS: The Sysadmin Guide to Working with EC2, IAM, and S3
Exam Pass App — mais de 7.000 questões LPI, offline, em 5 idiomas, disponível no Android e na App Store
Available on
Google Play
Available on
App Store

Linux and AWS are the most requested combination in infrastructure jobs today. Every EC2 instance is a Linux machine — and understanding the system underneath separates the sysadmin who resolves problems from those waiting for the cloud to solve it on its own.

AWS CLI on Linux

The first step to working with AWS on the terminal is installing and configuring the AWS CLI:

# Instalação (Linux x86_64)
curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

# Verificar instalação
aws --version

# Configurar credenciais
aws configure
# AWS Access Key ID: AKIA...
# AWS Secret Access Key: ...
# Default region name: us-east-1
# Default output format: json

# Testar autenticação
aws sts get-caller-identity

EC2: Linux in the Cloud

EC2 (Elastic Compute Cloud) is simply a Linux VM running on AWS. Everything you already know about Linux administration applies directly.

# Listar suas instâncias com estado e IP
aws ec2 describe-instances   --query 'Reservations[].Instances[].[InstanceId,State.Name,PublicIpAddress,Tags[?Key==`Name`].Value|[0]]'   --output table

# Iniciar instância parada
aws ec2 start-instances --instance-ids i-1234567890abcdef0

# Parar instância
aws ec2 stop-instances --instance-ids i-1234567890abcdef0

# Conectar via SSH — igual a qualquer servidor Linux
ssh -i ~/.ssh/minha-chave.pem [email protected]

User Data: Bootstrap on First Boot

# Criar instância com script de configuração automático
aws ec2 run-instances   --image-id ami-0c55b159cbfafe1f0   --instance-type t3.micro   --key-name minha-chave   --user-data file://setup.sh
#!/bin/bash
# setup.sh — roda como root na primeira inicialização
yum update -y
yum install -y nginx
systemctl enable nginx --now
echo "Servidor provisionado" > /usr/share/nginx/html/index.html

Security Groups: The AWS Firewall

Security Groups are the equivalent of ufw/iptables on AWS. They define which ports accept inbound and outbound traffic.

# Ver regras de um security group
aws ec2 describe-security-groups --group-ids sg-12345

# Liberar SSH apenas do seu IP atual
MY_IP=$(curl -s ifconfig.me)
aws ec2 authorize-security-group-ingress   --group-id sg-12345   --protocol tcp   --port 22   --cidr ${MY_IP}/32

# Liberar HTTP para o mundo
aws ec2 authorize-security-group-ingress   --group-id sg-12345   --protocol tcp   --port 80   --cidr 0.0.0.0/0

# Remover regra
aws ec2 revoke-security-group-ingress   --group-id sg-12345   --protocol tcp   --port 22   --cidr ${MY_IP}/32

IAM: Permissions on AWS

IAM (Identity and Access Management) is AWS's permission system. The concept is the same as in Linux — user, group, permission — but applied to cloud services.

# Criar usuário para deploy automatizado
aws iam create-user --user-name deploy-bot

# Criar chave de acesso para o usuário
aws iam create-access-key --user-name deploy-bot

# Adicionar política gerenciada (permissão pronta da AWS)
aws iam attach-user-policy   --user-name deploy-bot   --policy-arn arn:aws:iam::aws:policy/AmazonS3ReadOnlyAccess

# Ver políticas do usuário
aws iam list-attached-user-policies --user-name deploy-bot

Principle of Least Privilege: give only the permissions the user/service really needs — never AdministratorAccess for deploy bots.

S3: Storage and Backup

S3 is used to store static files, backups, logs, and container images:

# Criar bucket
aws s3 mb s3://meu-bucket-backup-2026

# Copiar arquivo para S3
aws s3 cp /var/log/app.log s3://meu-bucket-backup-2026/logs/

# Sincronizar diretório (como rsync, mas para S3)
aws s3 sync /var/backups/ s3://meu-bucket-backup-2026/backups/

# Listar objetos no bucket
aws s3 ls s3://meu-bucket-backup-2026/ --recursive --human-readable

# Download de arquivo
aws s3 cp s3://meu-bucket-backup-2026/backups/db.tar.gz /tmp/

Automatic Backup Script to S3

#!/bin/bash
# backup-s3.sh — agendar no cron
DATE=$(date +%Y-%m-%d)
BUCKET="s3://meu-bucket-backup"

# Backup do MySQL
mysqldump -u root -p$DB_PASS meu_banco | gzip > /tmp/backup-$DATE.sql.gz
aws s3 cp /tmp/backup-$DATE.sql.gz $BUCKET/mysql/
rm /tmp/backup-$DATE.sql.gz

echo "Backup $DATE concluído"

SSM Session Manager: SSH Without Port 22

AWS Systems Manager allows accessing instances without opening port 22, using IAM for authentication. Ideal for high-security environments:

# Instalar o plugin SSM (Amazon Linux)
sudo yum install -y session-manager-plugin

# Conectar a uma instância sem SSH exposto
aws ssm start-session --target i-1234567890abcdef0

# Rodar comando remoto sem sessão interativa
aws ssm send-command   --instance-ids i-1234567890abcdef0   --document-name "AWS-RunShellScript"   --parameters 'commands=["df -h"]'   --query 'Command.CommandId'   --output text

CloudWatch: Logs and Monitoring

# Ver grupos de logs
aws logs describe-log-groups --query 'logGroups[].logGroupName' --output table

# Consultar logs recentes (últimos 30 min)
aws logs filter-log-events   --log-group-name /var/log/nginx/access.log   --start-time $(date -d '30 minutes ago' +%s)000   --filter-pattern "ERROR"

The Linux Sysadmin Differentiator on AWS

Cloud engineers who don't understand Linux get stuck when the problem is in the operating system, not the infrastructure. Knowing how to read logs with journalctl, diagnose connectivity with ss and traceroute, and understanding file permissions makes you the professional who resolves the problem, not the one who opens a ticket.

The combination LPIC-1 + AWS Solutions Architect Associate is the profile with the highest salary difference between junior and mid-level in the Brazilian infrastructure market in 2026.

Uira Ribeiro

Prof. Uirá Ribeiro

Chair do Board do Linux Professional Institute

After years of watching professionals waste hours on simple tasks because they didn't know the right Linux tools, I decided to teach.
Today I'm the author of most of LPI's official Learning Materials and mentor to over 14,000 certified students.

See my full story →

That was just one piece. The course teaches the whole path — from your first command to exam day.

Certificação Linux — a plataforma líder em certificações Linux no Brasil
WhatsApp