Using the AWS CLI to work with AWS Services
Lets’ do some practice:
Create a key pair: aws ec2 create-key-pair --key-name CliKey --query 'KeyMaterial' --output text > CliKey.pem Display keys: aws ec2 describe-key-pairs Delete key: aws ec2 delete-key-pair --key-name CliKey
Launch your instance: aws ec2 run-instances --image-id ami-05d34d340fb1d89e5 --count 1 --instance-type t2.micro --key-name CliKey \ --security-group-ids sg-0515d6dcceeaecb25 --subnet-id subnet-e05efc8a List your instances: aws ec2 describe-instances --filters "Name=instance-type,Values=t2.micro" --query "Reservations[].Instances[].InstanceId" Terminate your instance: aws ec2 terminate-instances --instance-ids i-05e10617a1a3f33d1
List bucket: aws s3 ls List all files aws s3 ls s3://cv2.bezha.od.ua --recursive --human-readable --summarize Make bucket: aws s3 mb s3://bezha.od.ua Remove empty bucket: aws s3 rb s3://bezha.od.ua Delete all objects from s3://bezha.od.ua using the --recursive option: aws s3 rm s3://bezha.od.ua --recursive Sync objects: aws s3 sync . s3://test.bezha.od.ua