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
-
First Release Candidate for Linux Kernel 6.14 Now Available
Linus Torvalds has officially released the first release candidate for kernel 6.14 and it includes over 500,000 lines of modified code, making for a small release.
-
System76 Refreshes Meerkat Mini PC
If you're looking for a small form factor PC powered by Linux, System76 has exactly what you need in the Meerkat mini PC.
-
Gnome 48 Alpha Ready for Testing
The latest Gnome desktop alpha is now available with plenty of new features and improvements.
-
Wine 10 Includes Plenty to Excite Users
With its latest release, Wine has the usual crop of bug fixes and improvements, along with some exciting new features.
-
Linux Kernel 6.13 Offers Improvements for AMD/Apple Users
The latest Linux kernel is now available, and it includes plenty of improvements, especially for those who use AMD or Apple-based systems.
-
Gnome 48 Debuts New Audio Player
To date, the audio player found within the Gnome desktop has been meh at best, but with the upcoming release that all changes.
-
Plasma 6.3 Ready for Public Beta Testing
Plasma 6.3 will ship with KDE Gear 24.12.1 and KDE Frameworks 6.10, along with some new and exciting features.
-
Budgie 10.10 Scheduled for Q1 2025 with a Surprising Desktop Update
If Budgie is your desktop environment of choice, 2025 is going to be a great year for you.
-
Firefox 134 Offers Improvements for Linux Version
Fans of Linux and Firefox rejoice, as there's a new version available that includes some handy updates.
-
Serpent OS Arrives with a New Alpha Release
After months of silence, Ikey Doherty has released a new alpha for his Serpent OS.