Lista de 50 de los comandos más utiles de AWS Command Line Interface:

EC2:

  1. aws ec2 describe-vpcs: View details of Virtual Private Clouds (VPCs) in your account.
  2. aws ec2 create-security-group: Create a new security group for EC2 instances.
  3. aws ec2 authorize-security-group-ingress: Add inbound rules to a security group.
  4. aws ec2 create-key-pair: Create a new key pair for SSH access to EC2 instances.
  5. aws ec2 run-instances: Launch new EC2 instances.
  6. aws ec2 terminate-instances: Terminate running EC2 instances.
  7. aws ec2 create-volume: Create a new EBS volume.
  8. aws ec2 attach-volume: Attach an EBS volume to an EC2 instance.
  9. aws ec2 create-image: Create an Amazon Machine Image (AMI) from a running EC2 instance.
  10. aws ec2 describe-images: Get details about available EC2 images (AMIs).
  11. aws ec2 create-internet-gateway: Create a new internet gateway for VPC.
  12. aws ec2 attach-internet-gateway: Attach an internet gateway to a VPC.
aws ec2 describe-vpcs
aws ec2 create-security-group --group-name MySecurityGroup --description "My security group"
aws ec2 authorize-security-group-ingress --group-id sg-0123456789 --protocol tcp --port 22 --cidr 0.0.0.0/0
aws ec2 create-key-pair --key-name MyKeyPair
aws ec2 run-instances --image-id ami-0123456789 --instance-type t2.micro --key-name MyKeyPair --security-group-ids sg-0123456789
aws ec2 terminate-instances --instance-ids i-0123456789
aws ec2 create-volume --availability-zone us-east-1a --size 10
aws ec2 attach-volume --volume-id vol-0123456789 --instance-id i-0123456789 --device /dev/sdf
aws ec2 create-image --instance-id i-0123456789 --name "My server snapshot"
aws ec2 describe-images --owners self
aws ec2 create-internet-gateway
aws ec2 attach-internet-gateway --internet-gateway-id igw-0123456789 --vpc-id vpc-0123456789

RDS:

  1. aws rds create-db-instance: Create a new Amazon RDS database instance.
  2. aws rds create-db-snapshot: Create a snapshot of an Amazon RDS database.
  3. aws rds restore-db-instance-from-db-snapshot: Restore an RDS database instance from a snapshot.
  4. rds delete-db-instance: Delete an Amazon RDS database instance.
aws rds create-db-instance --db-instance-identifier MyDBInstance --db-instance-class db.t2.micro --engine mysql --master-username a
aws rds create-db-snapshot --db-instance-identifier MyDBInstance --db-snapshot-identifier MyDBSnapshot
aws rds restore-db-instance-from-db-snapshot --db-instance-identifier MyNewDBInstance --db-snapshot-identifier MyDBSnapshot. aws
aws rds delete-db-instance --db-instance-identifier MyDBInstance --skip-final-snapshot

LAMBDA

  1. aws lambda create-function: Create a new AWS Lambda function.
  2. aws lambda invoke: Invoke a specific AWS Lambda function.
aws lambda create-function --function-name MyFunction --runtime nodejs14.x --handler index.handler --zip-file fileb://function.zip
aws lambda invoke --function-name MyFunction --payload '{ "key": "value" }' output.txt

CLOUDFRONT

  1. aws cloudfront create-distribution: Create a new CloudFront distribution.
  2. aws cloudfront get-distribution: Get details about a CloudFront distribution.
aws cloudfront create-distribution --origin-domain-name mybucket.s3.amazonaws.com
aws cloudfront get-distribution --id E1EXAMPLEID

CLOUDTRAIL

  1. aws cloudwatch put-metric-alarm: Create a new CloudWatch alarm.
  2. aws cloudformation create-stack: Create a new CloudFormation stack.
  3. aws cloudformation describe-stacks: Get details about CloudFormation stacks.
  4. aws cloudtrail describe-trails: List all CloudTrail trails.
  5. aws cloudtrail start-logging: Enable CloudTrail logging.
aws cloudwatch put-metric-alarm --alarm-name MyCPUAlarm --comparison-operator GreaterThanOrEqualToThreshold --evaluation-periods 2 --metric-name CPUUtilization --namespace AWS/EC2 --period 300 --statistic Average --threshold 70 --alarm-actions arn:aws:sns:us-east-1:123456789012:MyTopic
aws cloudformation create-stack --stack-name MyStack --template-body file://template.json --parameters ParameterKey=InstanceType,ParameterValue=t2.micro
aws cloudformation describe-stacks
aws cloudtrail describe-trails
aws cloudtrail start-logging --name MyTrail

S3

  1. aws s3 mb: Create a new S3 bucket.
  2. aws s3 rm: Delete objects from an S3 bucket.
  3. aws s3 sync: Synchronize local files with an S3 bucket.
  4. aws s3api put-bucket-policy: Set a bucket policy for fine-grained access control.
  5. aws s3api get-bucket-encryption: Retrieve S3 bucket encryption configuration.
  6. aws s3api put-bucket-encryption: Enable default encryption for a bucket
aws s3 mb s3://my-new-bucket
aws s3 rm s3://my-bucket/my-object.txt
aws s3 sync /my/local/folder s3://my-bucket/my-remote-folder
aws s3api put-bucket-policy --bucket my-bucket --policy file://policy.json
aws s3api get-bucket-encryption --bucket my-bucket
aws s3api put-bucket-encryption --bucket my-bucket --server-side-encryption-configuration '{"Rules": [{"ApplyServerSideEncryptionByDefault": {"SSEAlgorithm": "AES256"}}]}'

SQS

  1. aws sqs send-message: Send a message to an Amazon SQS queue.
  2. aws sqs receive-message: Retrieve messages from an SQS queue.
  3. aws sqs delete-message: Delete a message from an SQS queue.
aws sqs send-message --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue --message-body "Hello, SQS!"
aws sqs receive-message --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue
aws sqs delete-message --queue-url https://sqs.us-east-1.amazonaws.com/123456789012/MyQueue --receipt-handle "AQEBHY7e3P..."

SNS

  1. aws sns create-topic: Create a new Amazon SNS topic.
  2. aws sns subscribe: Subscribe to an Amazon SNS topic.
aws sns create-topic --name MyTopic
aws sns subscribe --topic-arn arn:aws:sns:us-east-1:123456789012:MyTopic --protocol email --notification-endpoint my-email@example.com

IAM

  1. aws iam create-user: Create a new IAM user.
  2. aws iam list-users: List all IAM users in your AWS account.
  3. aws iam create-group: Create a new IAM group.
  4. aws iam list-groups: List all IAM groups in your AWS account.
  5. aws iam attach-group-policy: Attach a managed IAM policy to a group.
  6. aws iam create-role: Create a new IAM role.
  7. aws iam list-roles: List all IAM roles in your AWS account.
  8. aws iam attach-role-policy: Attach a managed IAM policy to a role.
  9. aws iam put-role-policy: Attach a custom IAM policy to a role.
  10. aws iam create-instance-profile: Create a new IAM instance profile.
  11. aws iam add-role-to-instance-profile: Add a role to an IAM instance profile.
  12. aws iam list-instance-profiles: List all IAM instance profiles in your AWS account.
  13. aws iam create-policy: Create a custom IAM policy.
  14. aws iam get-policy: Get details about a custom IAM policy.
aws iam create-user --user-name MyUser
aws iam list-users
aws iam create-group --group-name MyGroup
aws iam list-groups
aws iam attach-group-policy --group-name MyGroup --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess
aws iam create-role --role-name MyRole --assume-role-policy-document file://trust-policy.json
aws iam list-roles
aws iam attach-role-policy --role-name MyRole --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess
aws iam put-role-policy --role-name MyRole --policy-name MyCustomPolicy --policy-document file://custom-policy.json
aws iam create-instance-profile --instance-profile-name MyInstanceProfile
aws iam add-role-to-instance-profile --instance-profile-name MyInstanceProfile --role-name MyRole
aws iam list-instance-profiles
aws iam create-policy --policy-name MyCustomPolicy --policy-document file://custom-policy.json
aws iam get-policy --policy-arn arn:aws:iam::123456789012:policy/MyCustomPolicy