Amazon Web Services (AWS) is a comprehensive cloud computing platform provided by Amazon. It offers a wide array of services including compute power, database storage, content delivery, and other functionality to help businesses scale and grow.
The AWS Management Console is a web application for managing Amazon Web Services.
Accessing the Console:
Console Organization:
Creating a New Service:
The AWS CLI allows you to interact with AWS services using commands in your command-line shell.
Installation:
pip install awscli
Configuration:
aws configure
Enter your AWS Access Key ID, Secret Access Key, region, and output format.
Basic Command Structure:
aws <service> <command> <options>
Example Commands:
aws s3 ls
aws ec2 describe-instances
aws rds create-db-instance --engine mysql --db-instance-identifier mydb --db-instance-class db.t2.micro --master-username admin --master-user-password mypassword --allocated-storage 20
EC2 provides scalable computing capacity in the AWS cloud.
Launch an Instance:
Connect to an Instance:
ssh -i "your-key-pair.pem" ec2-user@your-instance-public-dns
Stop/Start an Instance:
aws ec2 stop-instances --instance-ids i-1234567890abcdef0
aws ec2 start-instances --instance-ids i-1234567890abcdef0
Terminate an Instance:
aws ec2 terminate-instances --instance-ids i-1234567890abcdef0
S3 is an object storage service offering industry-leading scalability, data availability, security, and performance.
Create a Bucket:
aws s3 mb s3://my-bucket-name
Upload a File:
aws s3 cp myfile.txt s3://my-bucket-name
List Bucket Contents:
aws s3 ls s3://my-bucket-name
Delete a File:
aws s3 rm s3://my-bucket-name/myfile.txt
Sync Local Directory with S3:
aws s3 sync . s3://my-bucket-name
IAM enables you to manage access to AWS services and resources securely.
Create a New IAM User:
aws iam create-user --user-name myuser
Attach Policy to User:
aws iam attach-user-policy --user-name myuser --policy-arn arn:aws:iam::aws:policy/AmazonS3FullAccess
Create Access Key for User:
aws iam create-access-key --user-name myuser
List Users:
aws iam list-users
RDS makes it easy to set up, operate, and scale a relational database in the cloud.
Create a DB Instance:
aws rds create-db-instance --db-instance-identifier mydb --db-instance-class db.t3.micro --engine mysql --master-username admin --master-user-password password --allocated-storage 20
Describe DB Instances:
aws rds describe-db-instances
Take a DB Snapshot:
aws rds create-db-snapshot --db-instance-identifier mydb --db-snapshot-identifier mydb-snapshot
Delete a DB Instance:
aws rds delete-db-instance --db-instance-identifier mydb --skip-final-snapshot
AWS Lambda lets you run code without provisioning or managing servers.
Create a Lambda Function:
aws lambda create-function --function-name my-function --runtime python3.8 --role arn:aws:iam::123456789012:role/lambda-role --handler lambda_function.lambda_handler --zip-file fileb://function.zip
Invoke a Lambda Function:
aws lambda invoke --function-name my-function --payload '{"key1": "value1", "key2": "value2"}' output.txt
Update Lambda Function Code:
aws lambda update-function-code --function-name my-function --zip-file fileb://function.zip
Delete a Lambda Function:
aws lambda delete-function --function-name my-function
CloudFormation provides a common language to describe and provision all the infrastructure resources in your cloud environment.
Create a Stack:
aws cloudformation create-stack --stack-name my-stack --template-body file://template.yaml
Update a Stack:
aws cloudformation update-stack --stack-name my-stack --template-body file://updated-template.yaml
Describe Stack Resources:
aws cloudformation describe-stack-resources --stack-name my-stack
Delete a Stack:
aws cloudformation delete-stack --stack-name my-stack
Amazon VPC lets you provision a logically isolated section of the AWS Cloud where you can launch AWS resources in a virtual network that you define.
Create a VPC:
aws ec2 create-vpc --cidr-block 10.0.0.0/16
Create a Subnet:
aws ec2 create-subnet --vpc-id vpc-1234567890abcdef0 --cidr-block 10.0.1.0/24
Create an Internet Gateway:
aws ec2 create-internet-gateway
aws ec2 attach-internet-gateway --vpc-id vpc-1234567890abcdef0 --internet-gateway-id igw-1234567890abcdef0
Create a Route Table:
aws ec2 create-route-table --vpc-id vpc-1234567890abcdef0
aws ec2 create-route --route-table-id rtb-1234567890abcdef0 --destination-cidr-block 0.0.0.0/0 --gateway-id igw-1234567890abcdef0
Amazon CloudWatch is a monitoring and observability service built for DevOps engineers, developers, site reliability engineers (SREs), and IT managers.
Create an Alarm:
aws cloudwatch put-metric-alarm --alarm-name cpu-mon --alarm-description "Alarm when CPU exceeds 70%" --metric-name CPUUtilization --namespace AWS/EC2 --statistic Average --period 300 --threshold 70 --comparison-operator GreaterThanThreshold --dimensions Name=InstanceId,Value=i-12345678 --evaluation-periods 2 --alarm-actions arn:aws:sns:us-east-1:111122223333:MyTopic --unit Percent
List Metrics:
aws cloudwatch list-metrics --namespace AWS/EC2
Get Metric Statistics:
aws cloudwatch get-metric-statistics --namespace AWS/EC2 --metric-name CPUUtilization --dimensions Name=InstanceId,Value=i-12345678 --start-time 2022-10-01T00:00:00 --end-time 2022-10-02T00:00:00 --period 3600 --statistics Average
Create a Dashboard:
aws cloudwatch put-dashboard --dashboard-name MyDashboard --dashboard-body file://dashboard-body.json
2024 © All rights reserved - buraxta.com