← Về AWS Practice LabAWS PRACTICE LIBRARY

Bài tập thực hành & lời giải

Chạy trong môi trường mô phỏng; cú pháp bám sát AWS CLI v2. Không có lệnh nào gọi AWS thật.

01IAM

Tạo người dùng thực hành theo nguyên tắc tối thiểu

Tạo IAM user lab-reader, sau đó kiểm tra thông tin user.

Lời giải

$ aws iam create-user --user-name lab-reader$ aws iam get-user --user-name lab-reader
02S3

Tạo bucket theo Region

Tạo bucket tên duy nhất tại ap-southeast-1 và kiểm tra danh sách bucket.

Lời giải

$ aws s3api create-bucket --bucket my-unique-lab-bucket --region ap-southeast-1 --create-bucket-configuration LocationConstraint=ap-southeast-1$ aws s3 ls
03EC2

Khởi tạo một EC2 t3.micro

Tạo một instance t3.micro từ AMI đã biết, sau đó xem trạng thái instance.

Lời giải

$ aws ec2 run-instances --image-id ami-0123456789abcdef0 --instance-type t3.micro --count 1$ aws ec2 describe-instances
04EC2

Dừng và chạy lại instance

Với instance ID i-0123456789abcdef0, dừng rồi khởi động lại máy.

Lời giải

$ aws ec2 stop-instances --instance-ids i-0123456789abcdef0$ aws ec2 start-instances --instance-ids i-0123456789abcdef0
05DynamoDB

Tạo bảng khóa chính đơn

Tạo bảng Users với partition key userId kiểu string, chế độ on-demand.

Lời giải

$ aws dynamodb create-table --table-name Users --attribute-definitions AttributeName=userId,AttributeType=S --key-schema AttributeName=userId,KeyType=HASH --billing-mode PAY_PER_REQUEST$ aws dynamodb describe-table --table-name Users
06Lambda

Kiểm tra Lambda đã triển khai

Liệt kê các Lambda function và xem cấu hình function hello-lab.

Lời giải

$ aws lambda list-functions$ aws lambda get-function --function-name hello-lab
07VPC

Khám phá mạng

Liệt kê VPC và subnet có sẵn trong Region đang chọn.

Lời giải

$ aws ec2 describe-vpcs$ aws ec2 describe-subnets
08CloudWatch

Kiểm tra cảnh báo

Liệt kê CloudWatch alarms hiện có để rà soát giám sát.

Lời giải

$ aws cloudwatch describe-alarms