Lista de 50 de los comandos más utiles de AWS Command Line Interface:
EC2:
- aws ec2 describe-vpcs: View details of Virtual Private Clouds (VPCs) in your account.
- aws ec2 create-security-group: Create a new security group for EC2 instances.
- aws ec2 authorize-security-group-ingress: Add inbound rules to a security group.
- aws ec2 create-key-pair: Create a new key pair for SSH access to EC2 instances.
- aws ec2 run-instances: Launch new EC2 instances.
- aws ec2 terminate-instances: Terminate running EC2 instances.
- aws ec2 create-volume: Create a new EBS volume.
- aws ec2 attach-volume: Attach an EBS volume to an EC2 instance.
- aws ec2 create-image: Create an Amazon Machine Image (AMI) from a running EC2 instance.
- aws ec2 describe-images: Get details about available EC2 images (AMIs).
- aws ec2 create-internet-gateway: Create a new internet gateway for VPC.
- 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:
- aws rds create-db-instance: Create a new Amazon RDS database instance.
- aws rds create-db-snapshot: Create a snapshot of an Amazon RDS database.
- aws rds restore-db-instance-from-db-snapshot: Restore an RDS database instance from a snapshot.
- 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
- aws lambda create-function: Create a new AWS Lambda function.
- 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
- aws cloudfront create-distribution: Create a new CloudFront distribution.
- 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
- aws cloudwatch put-metric-alarm: Create a new CloudWatch alarm.
- aws cloudformation create-stack: Create a new CloudFormation stack.
- aws cloudformation describe-stacks: Get details about CloudFormation stacks.
- aws cloudtrail describe-trails: List all CloudTrail trails.
- 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
- aws s3 mb: Create a new S3 bucket.
- aws s3 rm: Delete objects from an S3 bucket.
- aws s3 sync: Synchronize local files with an S3 bucket.
- aws s3api put-bucket-policy: Set a bucket policy for fine-grained access control.
- aws s3api get-bucket-encryption: Retrieve S3 bucket encryption configuration.
- 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
- aws sqs send-message: Send a message to an Amazon SQS queue.
- aws sqs receive-message: Retrieve messages from an SQS queue.
- 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
- aws sns create-topic: Create a new Amazon SNS topic.
- 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
- aws iam create-user: Create a new IAM user.
- aws iam list-users: List all IAM users in your AWS account.
- aws iam create-group: Create a new IAM group.
- aws iam list-groups: List all IAM groups in your AWS account.
- aws iam attach-group-policy: Attach a managed IAM policy to a group.
- aws iam create-role: Create a new IAM role.
- aws iam list-roles: List all IAM roles in your AWS account.
- aws iam attach-role-policy: Attach a managed IAM policy to a role.
- aws iam put-role-policy: Attach a custom IAM policy to a role.
- aws iam create-instance-profile: Create a new IAM instance profile.
- aws iam add-role-to-instance-profile: Add a role to an IAM instance profile.
- aws iam list-instance-profiles: List all IAM instance profiles in your AWS account.
- aws iam create-policy: Create a custom IAM policy.
- 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