[AWS] SSH into EC2 instanse
When Launch a new EC2 instance, in the final step, you can create a new private key pair and download it as pem file.
For example, I have one call `mynewkeypair.pem`.
Secrity group:
When creating security group, you need to make sure, you have allow `Anywhere` for `HTTP` & `SSH` (just for testing, not for production)
1. Change premission for pem file:
chmod 400 mynewkeypair.pem
2. SSH into EC2:
ssh ec2-user@<public_ipv4_address> -i mynewkeypair.pem
You can find <public_ipv4_address> in EC2 instanse information.
3. Type `yes` to continue
4. When successfully login, you will see:
Now, let's say, we want to turn our linux server as web hosting server.
1. Switch to root user
sudo su
2. Check any packages need to be udpated
yum update -y
3. Install Apache server:
yum install httpd -y
4. Start the server:
systemctl start httpd
This start the server manually, if we want to start the server automaticlly when the server bootstrap, we can do:
systemctl enable httpd
5. Verify:
systemctl status httpd
You can see:
Active: active (running) since Mon 2021-03-22 08:43:11 UTC; 1min 59s ago
6. Add new webpage:
cd /var/www/html nano index.html
Add simple html:
<html><body><h1>Hello Cloud Guru!!</h1></body></html>
Save the file:
Ctrl + X
Y
Enter
7. See the page:
Copy the Public IP address and paste into browser, you should see the hello message
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· SQL Server 2025 AI相关能力初探
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· Manus重磅发布:全球首款通用AI代理技术深度解析与实战指南
· 开源Multi-agent AI智能体框架aevatar.ai,欢迎大家贡献代码
· 被坑几百块钱后,我竟然真的恢复了删除的微信聊天记录!
· AI技术革命,工作效率10个最佳AI工具
2020-03-22 [Javascript] Create an Async Generator and Loop Through Generated Promises with "For Await Of" Loops
2020-03-22 [Javascript] Use an Array of Promises with a For Await Of Loop
2020-03-22 [macOS] macOS Catalina 10.15: Setting up a Brand New Mac for Development
2020-03-22 [Javascript] NaN is number type and NaN === NaN is false
2020-03-22 [Javascript] -0 & 0
2020-03-22 [Javascript] Object mental model
2019-03-22 [Angular] Use Angular components in AngularJS applications with Angular Elements