Set up Amazon Web Services
New Home
When applications run in a cloud system on Amazon Web Services, operators can forget management worries and concentrate instead on the essence of the app. Codemeister Mike Schilli performs the basic setup of the web service in the first part of this workshop.
Start-up companies attempting to shake the market in a flash and preparing for the onslaught of millions of happy users usually won't spend time or resources tending a server farm whose operation needs a knack for patches, reliability, and scaling. Streaming services such as Netflix and Spotify make no secret of the fact that large parts of their infrastructure run on rented clouds operated by Amazon Web Services (AWS). Although that makes them dependent on the operator, apparently even industry giants gain advantages by outsourcing infrastructure.
Choice
If you want to start off on a small scale and take your first few steps in the direction of cloud deployment, you first face a tangled mess of different service offerings and the emotional hurdle of credit card-based server operation. Amazon only takes your money, however, if you go beyond the scope of their free tier [1].
When I recently decided to make my surveillance video motion detection method [2] publicly available in the cloud, After reading about event-driven serverless applications [3] and building single-page apps on AWS [4], I was surprised, on the one hand, how quickly you can set up a web service at the command line and, on the other, the amazingly confusing number of configuration tweaks you need to adjust.
Storage by the Bucket
Amazon stores everything that defines a web service – the code that runs when a browser points to it and the configuration of access permissions – in its Simple Storage Service (S3). Because AWS also can deliver files to a web server as static content on request, this is often the first step into the world of clouds; more complex tasks then follow, such as setting up databases, operating back-end servers, or verifying user IDs.
At console.aws.amazon.com, the console is the central entry point (Figure 1) where you enter your Amazon ID; online shoppers will probably already have registered a credit card there. The Services tab then takes the newcomer to a page that lists a couple of dozen Amazon server offerings; you need to select IAM (identity and access management) here to be able to create a new user and assign the necessary permissions for cloud operation.
If you checked the Programmatic access box in Figure 1, you are given an access ID and a secret access key, which you can use later to configure the cloud working with your account via the aws
command-line tool.
On the following page, you grant rights by assigning policies. From the tangled mess of a few dozen boxes, you will want to pick the Attach existing policies directly option and select the AdministratorAccess policy so you can create new S3 buckets in which to store your code files (Figure 2). Later on, as a good security practice, installed application policies with less far-reaching rights are available (i.e., for going live with new releases). Policies can also be combined strategically with the help of roles.
When you press the button to confirm, the console outputs an access ID for later identification and a secret access key, much like a password (Figure 3). The aws
command-line tool itself is written in Python. On Ubuntu or Debian, you can then use:
sudo apt-get install python-pip sudo pip install awscli
to install the tool. For it to be able to access the cloud servers later, the command-line call in Figure 4 configures the local ~/.aws/credentials
file with the values received earlier; subsequent calls to aws
functions later on will find the access parameters there and pass them into the AWS gatekeeper.
The call also defines region US-east-1
as the data center closest to you from among Amazon's selection of data centers worldwide. Not all data centers offer the same services; thus, you need to clarify in advance whether the nearest one meets all your requirements.
Server Trick
The sequence in Figure 5 creates a new S3 bucket to hold files (e.g., index.html
) as a static test page and uses the sync
command to drop the file into the bucket. The sub-command website
then defines index.html
as the web server's entry point and error.html
as the error message file. After that, Amazon will happily serve up the page at the designated entry point, as if it were behind a normal web server (Figure 6).
It is your own responsibility to define easier-to-remember DNS records outside the amazonaws.com
domain; a CNAME
entry with your choice of provider will then point users to the cloud server.
Buy this article as PDF
(incl. VAT)
Buy Linux Magazine
Subscribe to our Linux Newsletters
Find Linux and Open Source Jobs
Subscribe to our ADMIN Newsletters
Support Our Work
Linux Magazine content is made possible with support from readers like you. Please consider contributing when you’ve found an article to be beneficial.
News
-
There's a New Open Source Terminal App in Town
Ghostty is a new Linux terminal app that's fast, feature-rich, and offers a platform-native GUI while remaining cross-platform.
-
Fedora Asahi Remix 41 Available for Apple Silicon
If you have an Apple Silicon Mac and you're hoping to install Fedora, you're in luck because the latest release supports the M1 and M2 chips.
-
Systemd Fixes Bug While Facing New Challenger in GNU Shepherd
The systemd developers have fixed a really nasty bug amid the release of the new GNU Shepherd init system.
-
AlmaLinux 10.0 Beta Released
The AlmaLinux OS Foundation has announced the availability of AlmaLinux 10.0 Beta ("Purple Lion") for all supported devices with significant changes.
-
Gnome 47.2 Now Available
Gnome 47.2 is now available for general use but don't expect much in the way of newness, as this is all about improvements and bug fixes.
-
Latest Cinnamon Desktop Releases with a Bold New Look
Just in time for the holidays, the developer of the Cinnamon desktop has shipped a new release to help spice up your eggnog with new features and a new look.
-
Armbian 24.11 Released with Expanded Hardware Support
If you've been waiting for Armbian to support OrangePi 5 Max and Radxa ROCK 5B+, the wait is over.
-
SUSE Renames Several Products for Better Name Recognition
SUSE has been a very powerful player in the European market, but it knows it must branch out to gain serious traction. Will a name change do the trick?
-
ESET Discovers New Linux Malware
WolfsBane is an all-in-one malware that has hit the Linux operating system and includes a dropper, a launcher, and a backdoor.
-
New Linux Kernel Patch Allows Forcing a CPU Mitigation
Even when CPU mitigations can consume precious CPU cycles, it might not be a bad idea to allow users to enable them, even if your machine isn't vulnerable.