As a developer, I have always hoped to have my own server to deploy applications. I have been interested in Alibaba Cloud/Tencent Cloud for a long time, but the trial period of both is not long. Alibaba’s is up to 30 days, while Tencent’s It only lasts 7 days. I have put it aside because I have no special needs
I heard that Amazon Cloud has a one-year free trial before, but I was worried that overseas servers might be inconvenient, so I didn’t try it. Recently, on a boring afternoon, I finally decided to give it a try. I fiddled with two items and it seemed quite convenient. Now I put myself Let me summarize my experience of stepping into pitfalls and share it with you.
The free qualifications of Amazon Cloud (AWS for short) are quite generous. New users can get a one-year free trial qualification. So the first step is to apply for an account on AWS, and all you need to prepare is an email and a credit card .
AWS cloud service has a Chinese official website, so the operation is relatively convenient. Unfortunately, the access speed is relatively slow, and we need enough patience. You can click Create a free account directly on the page to enter the registration page, or AWS Console - Signup, just follow the steps step by step. During the registration process, you will be bound to a credit card number and deduct a $1 pre-authorization. There will not be any prompts such as verification codes. However, it is said that Amazon’s reputation is still It’s good, they won’t charge you randomly, and you can complain if you exceed the budget, so if you are worried, please stop, or limit your credit card to 0~
Because it’s been a long time since I applied for an account, I can’t remember the specific details, but in short it will be relatively smooth
After applying for an account, you can log in to the console
The first step into the console is that you can get familiar with the environment, but it is best for us to choose a home for the server. Click on the region where the server is located in the icon, and a list of all selectable regions will be displayed. Generally, the default is Oregon, USA. I chose Asia Pacific Tokyo, mainly because I heard that the latency is relatively low.
OK, prepare to create the first server instance in AWS. The process is also very simple. Click Start Instance, and you will enter the AWS image market. Note: If you want to try it for free, please choose the one that includes a free logo throughout the process. content. Since this is the first instance, choose a simple image.
This is an image configured with a simple development environment, Linux system. Select the Instance Type labeled Free Tier with Eligibility
We use the default configuration and click the review and start buttons directly. Then you will see some overviews. In fact, I don’t understand them very well, so just click start. AWS will then ask you to configure a key pair, which is your credential for remote access to the instance, and give it a name, such as MyPair. Download it and keep your key pair. The Amazon tutorial suggests that we put it under your user.ssh folder in C:Users, which may be a good idea.
After clicking Start, we return to the console and enter the instance tab. You will find that your newly created instance is starting. Don't wait a moment. When the instance status turns green running, your instance will be started.
When the instance is started, you will be assigned a public IP. This public IP will not change if you do not restart it. If you want a fixed IP, you can first look at #Elastic IP Application and Binding. In the AWS introductory tutorial, you will use the git command line to connect to the instance. If you have git installed, you can right-click Git Bash Here at any location
ssh -i <span class="hljs-string">'私钥地址\MyPair.pem'</span> ec2-<span class="hljs-symbol">user@</span>{公网IP 地址}
If the connection is successful, you will see the AWS welcome page.
Another option is available on AWS, using PuTTY to connect to a Linux instance from Windows. The tutorial is in Chinese and is not difficult to understand. The overall process is
WinSCP can be installed by exchanging instance files. If you have saved the session in PuTTY, you can import it directly without reconfiguring when opening WinSCP.
There is a detailed tutorial in the link just provided. If you don’t understand, you can study it carefully
We know that the public IP is actually the home of your server on the Internet. If your home is always moved, it will be easy for friends to find you. AWS will allocate a public IP to each instance, but it is not fixed. If we want to fix an IP, we need to apply for an elastic IP.
Applying for an elastic IP is very, very, very simple. You only need to enter the elastic IP tab page - assign a new address - allocate.
Action Note AWS’s elastic IP allocation policy is very interesting. It is free to apply for an IP, but there is a charge for idle time. The IP you apply for must be bound to a running instance, otherwise it will be charged at 0.05USD per hour. I incurred a 0.5USD bill just because I shut down an instance for one night.
So, the applied IP should be allocated immediately, just operate-associate address-select the associated instance-associate. If there are excess IPs, you can release them by operating - Release Address.
Each instance will have a security group policy to control the open status of the port. By default, only SSH port 22 is open. We can configure security group policies according to our own needs.
You can enter the security group policy through the best column of the instance status bar. For example, if I want to build a Web website, then I need to open port 80 and port 443 in the inbound policy. In the same way, if you build a website but cannot access it from the outside, it may be that your HTTP port is not open.
AWS free limit is relatively generous, with 750 hours of instance running time per month, which means that if you only open one instance, it will not exceed the limit if it is run 24 hours a day. There is 15G of outbound traffic every month. Generally, the traffic is quite expensive, so please use it and cherish it. For more information, see AWS Free Usage Plan FAQ.
Secondly, there is the elastic IP issue mentioned just now. If you are worried about it, you can not apply for an elastic IP. It is guaranteed that the IP will not be changed without shutting down the instance.
The above is the detailed content of Amazon Cloud sets up a server for free to create your instance. For more information, please follow other related articles on the PHP Chinese website!