Cloud lab: practise S3 buckets, SQS queues and DynamoDB tables with the AWS command line
This lab gives each student a practice cloud of their own: MiniStack, an emulator that answers the same requests as three Amazon Web Services, S3 for files, SQS for queues of messages and DynamoDB for tables. The student uses the AWS command line, the same tool they would use on the real thing, so what they type carries over. It goes with the Cloud computing practice module, whose assignments are written over captured answers.
It is not an attack lab and it is not AWS. Every copy has no route to the internet and none to any other student, nothing in it is billed, and it has no web page, so everything is typed in the terminal beside it. Only the three services are switched on: Lambda is deliberately off, because its functions would run a student’s own code inside the stack.
What students learn
How a cloud service is used from the command line: a bucket holds objects found by their keys (aws s3 mb, cp and ls), a queue holds messages that are received and then deleted to finish them (aws sqs create-queue, send-message, receive-message and delete-message), and a table holds items under a key that a query reads together (aws dynamodb create-table, put-item, get-item and query). They read the replies, including the error for a key that is not there, NoSuchKey from S3, and meet one difference between services: a missing DynamoDB item is an empty reply and not an error. They also see what an emulator is, a practice copy that is not the real service. It suits an introduction to cloud computing, or the storage and messaging half of a software engineering course.
Run it in your browser
The lab starts one service, cloud, and waits until it answers. The terminal has the AWS command line but no keys for the stack, so the lesson first sets a made-up key, a region and the stack’s address, http://cloud:4566. The stack checks no password, and on the real AWS you would not set the address.
- Open the Container page. Open Build on the bar and choose Run a container. Anybody may open it, and the Git lab and the SQL lab start with no account. Every other lab needs a free account: create one, sign in, then press Start.
- Find the lab. The Sample labs card lists every sample. Find Cloud (MiniStack).
- Press Start. Start runs it as it is, in one press. Edit the file first opens the compose file so you can change it before you start.
- Open it. On the lab’s page, press Open terminal. There is no link under In your browser because the stack has no web page. Type export AWS_ACCESS_KEY_ID=test AWS_SECRET_ACCESS_KEY=test AWS_DEFAULT_REGION=us-east-1 AWS_ENDPOINT_URL=http://cloud:4566, then aws s3 mb s3://lab-bucket, and the terminal answers make_bucket: lab-bucket. aws s3 ls lists it.
What to ask students to hand in
The replies to a short session of their own: a bucket with an object put, listed and got, a queue with a message sent, received and deleted, a table with an item put, got and queried, and the error for a key that is not there. Then one sentence on what MiniStack is not. A good answer says it is an emulator, a practice copy, and not AWS.
A basic lesson on this lab
Cloud Services Basics is a small lesson worked in this lab. In it a student sets the key and the address, makes a bucket and stores and reads an object, asks for a key that is not there, makes a queue and sends, receives and deletes a message, and makes a table and puts, gets and queries items. The lesson also says that only three services are switched on and that what they make is kept when the lab is stopped and started.
Free personal accounts have it in the Basics module, which is on Home, every college can copy it from the Library’s Basics folder, and a new college opens with it in a module called DevOps Labs (Sample). It is deliberately small: it shows a teacher what a lesson worked in a lab is, and the lab does the rest. Copy it into a module of your own to change it.
The code on GitHub
The compose file has no Dockerfile: it runs one stock public image, ministackorg/ministack, pinned to a version, with 256 MB of memory and its state in a named volume. MiniStack is licensed MIT and is not distributed by us. A setting in the file switches on S3, SQS and DynamoDB only, and a request for any other service, Lambda included, is refused with an error. The lab has no way out to the internet and no password, since nothing else can reach the stack. It is one service, and an emulator, so details of the real services, such as account numbers in a queue’s address, differ.
Set it as work
Say in the task what to hand in.
- Make the lab. In your module add a task and choose the Container lab card, then In a GitHub repository. Give https://github.com/mitsurutech/lab-cloud with the branch main. The compose file is the default, compose.yaml. Fork the repository first if you want to change it.
- Publish and try it. Publish pins the commit you were shown, so a later change in the repository does not alter a lab you have already set. Start your own copy first.
- Hand it out. Assign it like any task, with a due date if you want one, and say in the task what to do and what to hand in.
- Mark what is handed in. Open a student’s copy and the work they handed in, mark it, and send it back with a reason if it needs more.
Try this lab, and what it costs
A free personal account can work through the basic lessons in this lab, with enough free credit each month to follow most lessons and no card. For a class, a school or college has its first 365 days free for up to 50 students, then pays per student a year, with every lab included and staff free.
Questions people ask
- Is this AWS?
- No. It is MiniStack, an emulator that answers the same requests for S3, SQS and DynamoDB. Nothing in it is billed or leaves the copy, and it checks no password. The AWS command line is the real one, so what students type carries over to an account of their own.
- Why is Lambda switched off?
- A Lambda function is code the student writes, and the emulator would run it inside the stack’s own container. Switching the service off means there is nothing to run it with: a request for Lambda is refused with an error. The lab teaches storage, queues and tables, which do not need it.
- Why does the lesson set a key and an address first?
- The lab’s terminal has the AWS command line but no keys for the stack. The lesson sets a made-up key, which the emulator does not check, and the stack’s address, which the real AWS would not need.
- What is still there after I stop and start the lab?
- The buckets, objects, queues and tables you made. The stack keeps its state in a named volume, which the platform saves, and reads it when it starts. The terminal forgets the key and the address, so the lesson’s first command is run again.