I also recently discovered Linodes and got $100 for free. I have been using it for a week now, so I'm writing an article to record my experience. You can also refer to it if you want to get started!
Note: This article contains no advertisements, and our website will not display any advertisements! Here is a screenshot of the server running for 7 days.
The server I set up is an AMD EPYC 7642 with 6 cores and 16GB RAM in a Japanese data center. Currently, it is running some scripts to process some things.
It has been stable for 7 days, and I don't know how long it will remain stable or if I can fully utilize the $100 credit. I will update the specific situation below this paragraph when it happens!
First of all, I bought an account and logged in directly with the account password. At that time, I planned to create a free hosting website through the API, where everyone can play around with free servers that will be automatically destroyed after 72 hours. However, my account was banned, probably because I logged in manually. The login prompt indicated that the account password was incorrect, and I felt that the merchant had changed the password.
So I switched to another provider, and the price was around 45-55 RMB. Then I found that services like Amazon, Linodes, Vultr, etc., which can be used for free, can open machines through APIs. There are also websites specifically for opening machines.
Five-in-one panel for server management: https://cloud.bobu.me/ (Not an advertisement, I saw this in the product description when I purchased the account from the second provider, and it said that using the API is more stable.)
Before purchasing Linodes from the second provider, I bought an Amazon account that allows free usage for 32v. The first time I used it, I didn't understand it well, so I logged in manually and the account was banned the next day.
Summary:#
Currently, the Linodes account I purchased for around 50 RMB has been stable for about a week, and I have earned back at least 50 RMB. It is necessary to pay for the API panel to open this API.
If you don't want to pay for the API panel, you can contact chatgpt and ask it to write a PHP file for opening Linodes through the API. Try to avoid logging in manually to the account. Of course, a reliable account seller is also necessary. I always felt that the first account I bought had its password changed by the merchant.
In addition, the $100 credit from Linodes has a time limit, which seems to be three or two months. Don't hesitate to use it to open high-performance machines directly.
The suitable use cases for this are running some unimportant scripts. It is not suitable for hosting websites because you never know when it will go down.
It is great for experimenting and testing. Currently, I have also run some things, and the CPU usage is around 60%.
Experimenting Method#
If you have previously opened machines through APIs and your Linodes account is stable, or if you have the energy to experiment and are not afraid of server abnormalities causing traffic loss or SEO ranking issues, or if your scenario involves a fixed data CMS program and you want to spend less money to share server computing power, you can try the method below.
First, you need a spare server. There are many merchants offering discounted prices for spare servers.
Then install the happy version of Baota, because free is the happiest. For details, you can refer to my article Three Happy Versions of Baota: Free Baota Enterprise Edition with Communication Stripped.
Refer to my previous article A PHP File + Cloudflare for Failover! and configure some information according to the tutorial. Add a monitoring feature and you can start using it. Please deploy it on the spare server.
The download link for the code inside is invalid because I switched programs, so I will paste the complete code at the bottom.
You can install FTP storage + file synchronization in the Baota plugin and connect them to your spare server.
Or if you have a video website with no user data, only video data, then you must have a release page. You can add a Linodes domain name on the release page and set up file synchronization from the source server to the Linodes server. This way, you can share the computing power!
As long as you don't lose your creativity, there are always more solutions than difficulties. There is always a method that allows you to apply it reasonably!
Failover Code:#
<?php
header('Content-type:application/json');
// Token obtained after creating API, written after Bearer
$Authorization = 'Authorization: Bearer ';
// IP for ping detection
$pingip='';
// Zone ID
$id = '';
// DNS record ID to be modified, set $get_dnsid to true to get the record list, set dnsid and then set $get_dnsid to false
$dnsid = '';
// Record type
$dnstype = 'A';
// Name
$dnsname = '';
// Modified IP
$dnscontent = '';
// Proxy
(bool)$dnsproxied = false;
// TTL
$dnsttl = 1;
// Get DNS record ID list, set to true to display JSON format DNS record list when accessing the PHP address.
$get_dnsid = false;
if ($get_dnsid === true) {
// Get DNS ID
$api_dnsid = 'https://api.cloudflare.com/client/v4/zones/' . $id . '/dns_records';
try {
$json = curl_get($api_dnsid, [$Authorization]);
$json = json_decode($json);
echo json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT);
} catch (Exception $aaa) {
$json = [
'state' => 1,
'msg' => 'Error getting DNS ID from API'
];
echo json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT);
}
exit();
} else {
if (pingDomain($pingip, 443) === -1) {
changeDNS($dnstype, $dnsname, $dnscontent, $dnsproxied, $dnsttl, $id, $dnsid, $Authorization);
}
}
// Ping
function pingDomain($domain, $port)
{
try {
$starttime = microtime(true);
$file = fsockopen($domain, $port, $errno, $errstr, 10);
$stoptime = microtime(true);
$status = 0;
if (!$file) $status = -1; // Site is down
else {
fclose($file);
$status = ($stoptime - $starttime) * 1000;
$status = floor($status);
}
return $status;
} catch (\Exception $a) {
return false;
}
}
// Modify DNS
function changeDNS($dnstype, $dnsname, $dnscontent, $dnsproxied, $dnsttl, $id, $dnsid, $Authorization)
{
if ($dnsid != '') {
$api = 'https://api.cloudflare.com/client/v4/zones/' . $id . '/dns_records/' . $dnsid;
$json = [
'type' => $dnstype,
'name' => $dnsname,
'content' => $dnscontent,
'proxied' => $dnsproxied,
'ttl' => $dnsttl,
];
$json = json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE);
$temp = curl_patch($api, [$Authorization], $json);
$temp = json_decode($temp);
echo json_encode($temp, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT);
} else {
$json = [
'state' => 1,
'msg' => 'DNS ID is empty, please set DNS ID first'
];
echo json_encode($json, JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE | JSON_FORCE_OBJECT);
}
}
//--------------------------------------------------CURL
function curl_get($url, $header)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//curl_setopt($ch, CURLOPT_ENCODING,'gzip');
$contents = curl_exec($ch);
curl_close($ch);
//$contents = mb_convert_encoding($contents, 'utf-8','GB2312');
return $contents;
}
function curl_patch($url, $header, $data)
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 5);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_HTTPHEADER, $header);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, false);
//curl_setopt($ch, CURLOPT_ENCODING,'gzip');
$contents = curl_exec($ch);
curl_close($ch);
//$contents = mb_convert_encoding($contents, 'utf-8','GB2312');
return $contents;
}