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
-
Halcyon Creates Anti-Ransomware Protection for Linux
As more Linux systems are targeted by ransomware, Halcyon is stepping up its protection.
-
Valve and Arch Linux Announce Collaboration
Valve and Arch have come together for two projects that will have a serious impact on the Linux distribution.
-
Hacker Successfully Runs Linux on a CPU from the Early ‘70s
From the office of "Look what I can do," Dmitry Grinberg was able to get Linux running on a processor that was created in 1971.
-
OSI and LPI Form Strategic Alliance
With a goal of strengthening Linux and open source communities, this new alliance aims to nurture the growth of more highly skilled professionals.
-
Fedora 41 Beta Available with Some Interesting Additions
If you're a Fedora fan, you'll be excited to hear the beta version of the latest release is now available for testing and includes plenty of updates.
-
AlmaLinux Unveils New Hardware Certification Process
The AlmaLinux Hardware Certification Program run by the Certification Special Interest Group (SIG) aims to ensure seamless compatibility between AlmaLinux and a wide range of hardware configurations.
-
Wind River Introduces eLxr Pro Linux Solution
eLxr Pro offers an end-to-end Linux solution backed by expert commercial support.
-
Juno Tab 3 Launches with Ubuntu 24.04
Anyone looking for a full-blown Linux tablet need look no further. Juno has released the Tab 3.
-
New KDE Slimbook Plasma Available for Preorder
Powered by an AMD Ryzen CPU, the latest KDE Slimbook laptop is powerful enough for local AI tasks.
-
Rhino Linux Announces Latest "Quick Update"
If you prefer your Linux distribution to be of the rolling type, Rhino Linux delivers a beautiful and reliable experience.