This time, I will try to build a Linux server using AWS EC2. The AWS screen has changed since I created it. Since the UI of Internet services always changes suddenly, even if it is described in Qiita as know-how, it means that it is not immediately obsolete. So I'll try again. This is a reprint of the article I wrote before this article.
Use AWS EC2 to build a Linux server with Amazon Linux AMI2.
Tutorial: Getting started with Amazon EC2 Linux instances This is a description of creating an instance of Amazon's EC2 Linux. We will carry out according to this.
"Amazon EC2 Instance Types" A description of the instance type.
According to Amazon's EC2 page, the following is stated first:
Amazon Elastic Compute Cloud (Amazon EC2) is a web service that provides secure, resizable computing performance in the cloud. It is designed to make web-scale cloud computing easy for developers. Amazon EC2's simple web services interface allows you to get and configure the features you need without hassle. It provides powerful control over your computing resources and can run on Amazon's proven infrastructure.
I'm not sure what it is, but I think it's a virtual server.
There is an explanation on the AWS page about the charges, but it's difficult to understand. There is a lot of information on the net, but I still don't understand. So, I think the AWS EC2 charges for * on-demand * are roughly as follows.
--Instance startup time --DL data transfer amount
If you use an Elastic IP address,
--Elastic IP address usage time (only when Instance is not started)
Instance startup time is initially charged for 1 minute and then takes time or seconds. The DL data transfer fee is about * 1.088 USD / hour * for * c6g.8xlarge *. If the region is Tokyo. DL data transfer is free up to 1GB and costs $ 0.114 / month up to 9.999TB thereafter. After that, it will be a little cheaper, but it is set.
The Elastic IP address is for fixing the IP address. If you do not use it, stopping Instance will release the IP address, and when you start it, it will change to another IP address. It is 0.005 USD / hour.
It is a fee system that is difficult to understand. Launch Instance for one day: 0.0136 USD x 24 = 0.3264 USD 1 month (31 days): 0.3264 USD x 31 = 10.1184 USD It's difficult because the amount of data transferred depends on how much you use. Since the Elastic IP address is taken when the Instance is stopped, it does not take if it is kept running as described above. It costs $ 0.0136 to start and $ 0.005 to stop, so it's definitely cheaper to stop if you can.
Then, [Tutorial: Getting started with Amazon EC2 Linux instances](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EC2_GetStarted.html?trk=em_a131L000005jw1jQAA&trkCampaign=pac_EC2_docs_GettingStarted_GlobalEM&sc_channel=em_GlobalEM&sc_channel=em_GlobalEM&sc_channel=em_GlobalEM&sc_channel=em_GlobalEM&sc_channel=em NAMER & sc_country = mult according & sc_content = AWS_Webpage & mkt_tok = eyJpIjoiTVdJeFlXRTVNelJsTWpOaCIsInQiOiJKY0tIN1NYckFZeXNobUUyWmpuSjVlMEJuZmV1ZGh2ZkFLK2dQRHljTUd0Qlgrd1ZpV3VaM08zNTE0KzQ3NHlwMGdlYnl5MURlU0tQeFVna2hFdWpvdnBjS3RqTUFPYUNyUVwva0tDME04Vk9rTnhqc1poOG1XdnlJUU1sMTlqdTBsbVh5NjZQNElSNmhNWFdQcjBIKzl3PT0ifQ% 3D% 3D), will in turn make the creation of the Instance.
First, log in to AWS. Then choose EC2 for your service. This is the basics, so I won't explain it. If you press "Instance" on the left menu on the EC2 screen, the following screen will appear. Here, press the "Start Instance" button.
Next is the selection of Amazon AMI (Amazon Machine Image). It seems that about 40 AMIs are prepared. In short, I think it's what kind of OS to choose, but like last time, select "Amazon Linux AMI 2". The CPU uses 64-bit (Arm). Looking at the information on the net, it is natural, but there seems to be a difference in performance between X86 and Arm, so I thought that choosing the instance type depending on which CPU you want to use is one way.
This time, select "c6g.8xlarge". For instance types, "C6g.8xlarge" is Type: c6g Size: 8xlarge The type "c" indicates the classification, "6" is the 6th generation, and "g" is the AWS Graviton2 processor. It seems that this processor is faster and cheaper. According to "Amazon EC2 Instance Types", there seem to be various types.
The group of instances is broadly divided into "general purpose", "computer optimization", "memory optimization", "fast computing", and "storage optimization".
Well, there are various explanations, but at this point I already don't know which one to choose.
group | Explanation |
---|---|
General purpose | CPU、メモリなどバランスがとれており、General purpose的に使えるもので、特にないならこれを選ぶのがいいかと思います。 |
Computer optimization | It means that the CPU performance is high. It is applied even though there is a lot of processing. |
Memory optimization | The memory is optimized, but I wasn't sure. |
High speed computing | There is a separate coprocessor. GPU etc. will be added separately. It still depends on the application. |
Storage optimization | There seems to be NVMe SSD and HDD. |
Do you choose a group first? If you don't understand it, it will be general purpose. This seems to be difficult to choose. Even if a company chooses it, it is necessary to clarify the purpose, but first of all, I do not know which one, and even if it is said, I think that all are included. I wondered if it would be a safe general purpose.
Once the classification is decided, I think I will choose the type and then the size.
If you select with, the key pair will be selected next. If this is your first time, generate a key as "Create a new key pair". This key is very important because you will use it to access your Instance in the future, so you need to save it.
If you select it with this, the rest will be initialized and an Instance will be generated. It was easier than I expected. After this, Instance will stop stopping for the time being. Otherwise, it will be in the start state and you will be charged.
After that, I think that all you have to do is start Instance and make an SSH connection. In my case, I connect with Tera Term. The IP address will be displayed when you start Instance, so connect to it. The initial value is "ec2user" as the user name and no password. Since it is necessary to set the key, you can set the key DL above.
It is a rehash.
Recommended Posts