การเรียนรู้ AWS CLI: วิธีเริ่มอินสแตนซ์ EC2 บน Ubuntu อย่างมืออาชีพ.
ในการเริ่มอินสแตนซ์ EC2 โดยใช้ AWS CLI บน Ubuntu, ทำตามขั้นตอนเหล่านี้:
- Install the AWS CLI on your Ubuntu system, if it’s not already installed. You can use the following command to install it:
sudo apt-get update
sudo apt-get install awscli
2. กำหนดค่า AWS CLI โดยเรียกใช้คำสั่งต่อไปนี้:
aws configure
You’ll be prompted to enter your AWS access key ID, รหัสการเข้าถึงความลับ, default region name, and output format.
- Once the CLI is configured, you can use the following command to start your EC2 instances:
aws ec2 start-instances --instance-ids instance_id
แทนที่ “instance_id” with the actual ID of the EC2 instance you want to start. If you want to start multiple instances at once, you can specify their IDs separated by spaces.
ตัวอย่างเช่น, to start an instance with the ID “ฉัน-0123456789abcdef0”, you would use the following command:
aws ec2 start-instances --instance-ids i-0123456789abcdef0
If successful, the command will output a JSON object containing information about the started instances.