亚马逊云科技(AWS)是全球云行业最🔥火的云平台,在全球经济形势不好的大背景下,通过网课学习亚马逊云科技AWS基础备考亚马逊云科技AWS证书,对于找工作或者无背景转行做AWS帮助巨大。欢迎大家关注小李哥,及时了解世界最前沿的云计算、AI技术,快速成为国际云计算的专家。
什么是Udemy?
Udemy作为全球最大、最优质的网课平台之一,上面有非常多优质的亚马逊云科技AWS课程。但Udemy上的亚马逊云科技AWS课程最便宜的也要几十刀,最贵能到上百刀,十分昂贵。今天小李哥就给大家盘点全网最全的 Udemy上AWS免费高分课程大合集(选择标准为:评分4.4/5左右,好评500左右的课程)。
推荐优质学习资源
小李哥按课程方向类别给大家做了推荐,大家根据自己的需求选择。大家参考中的课程编号(非图1编号),排序为评分从高➡️低的排名
1️⃣ 用于AWS证书备考
3号Serverless computing in AWS: 适合云从业者(4.6分)
11号AWS VPC Transit Gateway - Hands On Learning! :适合助理级架构师(4.4分)
2️⃣ 适合无背景的AWS小白学习的课程
以下几门课程适用于完全没有背景的非IT人员(销售、市场等)、或者有初级背景的云计算从业者
4 AWS Certified Solutions Architect Associate Introduction(4.6分)
5 Amazon Web Services - Learning and Implementing AWS Solution(4.5分)
6 All About AWS Lambda and Serverless(4.5分)
9 Amazon Web Services (AWS) EC2: An Introduction(4.4分)
13 A Practical Introduction to Cloud Computing(4.3分)
3️⃣ AWS Serverless服务(适合云上软件开发)
7 AWS Tutorials - DynamoDB and Database Migration Service(4.4分)
8 Multitier architecture with AWS(4.4分)
15 AWS + Serverless(4.0分)
4️⃣ AWS网络(适合网络工程师/DevOps)
2 Amazon Web Services (AWS) - Zero to Hero(4.7分)
5️⃣ AWS架构/系统设计(适合☁️上开发/架构师)
12 Cloud Computing With Amazon Web Services(4.3分)
6️⃣ AWS DynamoDB and DMS (适合☁️数据岗)
1 Starting your Career with Amazon AWS(4.7分)
7️⃣ AWS cloudformation (软件定义代码、适合云上开发/DevOps)
14 Introduction to Cloud Computing for Beginners in 30 mins(4.2分)
8️⃣ AWS EC2 (适合云上DevOps/SysOps)
10 Amazon Web Services (AWS): CloudFormation(4.4分)
Udemy上的免费动手实验讲解:
今天给大家介绍的是如何用AWS Boto3 Python SDK创建EC2
首先我们安装Boto 3 SDK:
pip install awscli boto3
然后我们本地配置AWS的秘钥key
aws configure
示例输入:
$ aws configure
AWS Access Key ID [None]: ABCDEFGHIJKLMNOPQRST
AWS Secret Access Key [None]: abcdefghijklmnopqrstuvwxyz1234567890
Default region name [None]: us-west-2
Default output format [None]: json
接下来我们使用Python配置登录EC2服务器的SSH key pair:
import boto3
ec2 = boto3.resource('ec2')
# create a file to store the key locally
outfile = open('ec2-keypair.pem','w')
# call the boto ec2 function to create a key pair
key_pair = ec2.create_key_pair(KeyName='ec2-keypair')
# capture the key and store it in a file
KeyPairOut = str(key_pair.key_material)
print(KeyPairOut)
outfile.write(KeyPairOut)
创建成功后,我们利用Python创建一个EC2服务器,同时在EC2创建时启动NGINX。
import boto3
ec2 = boto3.resource('ec2')
# User data script to install Nginx
user_data_script = """#!/bin/bash
sudo apt-get update
sudo apt-get install -y nginx
sudo service nginx start
"""
# Create a new EC2 instance
instances = ec2.create_instances(
ImageId='ami-00b6a8a2bd28daf19',
MinCount=1,
MaxCount=2,
InstanceType='t2.micro',
KeyName='ec2-keypair',
UserData=user_data_script
)
# Print the instance IDs
for instance in instances:
print(f'Created instance with ID: {instance.id}')
对于保护EC2运行,提高云服务的稳定性、可用性,我们要定期为EC2创建镜像。在AWS上,镜像的形式叫做AMI,以下是常见AMI的代码。
import boto3
ec2 = boto3.client('ec2')
# Replace with your instance ID
instance_id = 'i-1234567890abcdef0'
# Create an AMI from the instance
response = ec2.create_image(
InstanceId=instance_id,
Name='MyServerImage',
Description='An AMI of my server',
NoReboot=True # Set to False if you want to reboot the instance before creating the image
)
image_id = response['ImageId']
print(f'AMI created with ID: {image_id}')
如果我们想重启、删除一个EC2服务器,可以用以下代码:
重启:
import boto3
ec2 = boto3.client('ec2')
# Replace with your instance ID
instance_id = 'i-1234567890abcdef0'
# Reboot the instance
response = ec2.reboot_instances(
InstanceIds=[instance_id]
)
print(f'Rebooted instance: {instance_id}')
删除:
import boto3
ec2 = boto3.client('ec2')
# Replace with your instance ID
instance_id = 'i-1234567890abcdef0'
# Terminate the instance
response = ec2.terminate_instances(
InstanceIds=[instance_id]
)
print(f'Terminated instance: {instance_id}')
对于EC2维护和访问,如果可以分配固定IP,将会保证EC2重启后IP保持不变。我们使用如下代码实现IP固定(分配Elastic IP)
import boto3
ec2 = boto3.client('ec2')
# Allocate a new Elastic IP address
response = ec2.allocate_address(
Domain='vpc'
)
allocation_id = response['AllocationId']
print(f'Elastic IP allocated with ID: {allocation_id}')
# Replace with your instance ID
instance_id = 'i-1234567890abcdef0'
# Associate the Elastic IP with the instance
response = ec2.associate_address(
InstanceId=instance_id,
AllocationId=allocation_id
)
print(f'Elastic IP associated with instance: {instance_id}')