- Mastering Symfony
- Sohail Salehi
- 688字
- 2021-07-16 11:29:01
Elastic Compute Cloud
Amazon Elastic Compute Cloud (EC2) is the largest public cloud in the world and we will use EC2 to set up our CI server.
Assuming that you have already created your free account on AWS, you should be able to see the console area when you log in.
As you can see in the following image, it is packed with loads of components, and if this is the first time you are here, it might look overwhelming. Don't worry, we only need two of these services for this chapter:

Creating a new instance
Our CI server is basically a virtual machine running Linux, which, in AWS terminology, is called an instance. So, from now on, when you see the term instance, it means a virtual machine on the cloud. To create your first instance, follow these steps:
- Under the Compute & Networking option, click on EC2.
- Before doing anything, you need to select the right region for better performance. In the upper-right hand corner of the page, there is a drop-down list where you can select the closest area to you, as shown in the following screenshot:
- Now, click on the big blue button saying Launch Instance and select the latest version of the Ubuntu server. Pay attention; some options have a Free tier eligible label and some don't. After selecting EC2, a validation from Amazon is required. This validation could take from several minutes to days:
- As you can see in the following screenshot, only t2.micro is free. Select this plan and click on Next: Configure Instance Details.
- The next two steps are configuration (3. Configure Instance) and adding storage (4. Add Storage). Simply accept the default settings and move on to Step 5: Tag Instance. Here, we will choose a Tag name for our virtual machine. Enter the name
Mava
in the Value field and proceed to the next step: - This step is where you set up the firewall for your CI server and define which ports should be open to the outside world. In the Security group name field, type
Mava
. We need SSH and HTTP access to our server, so click on the Add Rule button, choose HTTP, and press the Review and Launch button: - When you press the Review and Launch button, as shown in the following screenshot, it asks for a public and private key pair in order to access our EC2 instance. Choose Create a new key pair. Type the name
mava-keys
for it. Now you can click on the Launch Instances button. It takes a few seconds to generate the instance and when it is finished, you can click on the View Instances button to see it. Be patient as it takes a while to change the status from pending to running: - While it is in the running mode, click on your instance and copy the Public DNS address:
- Right now, you have enough information to connect to your EC2 instance:
ssh -i ~/Downloads/mava-keys.pem ubuntu@ec2-54-79-31-45.ap-southeast-2.compute.amazonaws.com
However, this is a very long command and not very safe as well. First, we want to make sure that only we have read and write access to our key. So fire a terminal window, copy the instance key to your
.ssh
folder, and set the permission as follows:$ mv ~/Downloads/mava-keys.pem ~/.ssh/ $ chmod 400 ~/.ssh/mava-keys.pem
- Now, for more convenience, let's create an alias for that long
ssh
command. Open the.ssh/config
file and add the following contents to it. Remember that forHostname
, you have to add your own Public DNS value that you copied from step 8:Host ec2 Hostname ec2-54-79-31-45.ap-southeast-2.compute.amazonaws.com User ubuntu IdentityFile ~/.ssh/mava-keys.pem
- Now you can connect to your instance via this short command:
ssh ec2
- For the first time, you will be prompted with the following:
Are you sure you want to continue connecting (yes/no)? Yes
- Answer
Yes
and congratulations! You are now connected to your EC2 instance on the Amazon cloud:ubuntu@ip-172-31-29-153:~$
- FFmpeg入門詳解:音視頻流媒體播放器原理及應用
- Django Design Patterns and Best Practices
- Apache Mesos Essentials
- Reactive Android Programming
- Windows Server 2016 Automation with PowerShell Cookbook(Second Edition)
- Python完全自學教程
- Yii Project Blueprints
- Java Web從入門到精通(第3版)
- 軟件工程與UML案例解析(第三版)
- 深入淺出Python數據分析
- 你好!Java
- Clojure編程樂趣
- Building Clouds with Windows Azure Pack
- Learning Dynamics NAV Patterns
- 現代JavaScript編程:經典范例與實踐技巧