diff --git a/content/AWS/02_intro_to_compute.ipynb b/content/AWS/02_intro_to_compute.ipynb new file mode 100644 index 0000000..363f553 --- /dev/null +++ b/content/AWS/02_intro_to_compute.ipynb @@ -0,0 +1,259 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "dc57021c", + "metadata": {}, + "source": [ + "# Introduction to Elastic Cloud Compute (EC2) - Part 1\n", + "\n", + "\n", + "```{admonition} Overview\n", + ":class: tip\n", + "\n", + "**Teaching:** 45 mins\n", + "\n", + "**Exercises:** 10 mins\n", + "\n", + "**Questions:**\n", + "* What is an EC2 instance?\n", + "* When would I use an EC2 instance?\n", + "* How do I launch an EC2 instance?\n", + "\n", + "**Objectives:**\n", + "* Understand the concept of virtual servers.\n", + "* Understand what an Elastic Cloud Compute (EC2) instance is.\n", + "* Understand how to launch an EC2 instance. \n", + "\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "502f2360", + "metadata": {}, + "source": [ + "Recall that the two fundamental components of cloud computing is compute and storage. On AWS, a \"virtual server\" or \"virtual computer\" is known as an **Elastic Cloud Compute (EC2) instance**; sometimes it's called \"EC2\", sometimes it's called an \"instance\" to denote that the ability to build and terminate this server instantaneously, but they all mean the same thing. An EC2 instance is no different from a server that sits under your desk, or your local departmental cluster, or even your local HPC cluster. You even boot up an EC2 instance through the web console, install software and then shut down your instance just like you would a real computer, except that Amazon takes care of the physical machinery while you are in charge of process of creating the computer. In some sense, you can think of utilizing an EC2 instance as renting a server or computer from Amazon! \n", + "\n", + "In cloud jargon, the term **elasticity** denotes the ability to quickly expand or decrease computer processing, memory, and storage resources to meet changing demands. In that way, you can expand the size of your CPU, RAM and disk size on your EC2 instance almost instantenously. Since EC2 forms the backbone of most of AWS's core infrastructure, it is an important part of your cloud journey. \n", + " \n", + "\n", + "Let's walk through some of the steps on getting an EC2 instance up and running. \n" + ] + }, + { + "cell_type": "markdown", + "id": "bc5d082d", + "metadata": {}, + "source": [ + "We begin with the AWS console again. Under the \"Build a Solution\" panel, select **Launch a Virtual Machine**\n", + "\n", + "![Start page for the AWS console](images/console_ec2.png)\n", + "\n", + "This will then lead you through a series of steps to get a **Free Tier** EC2 instance up and running. \n", + "\n", + "```{admonition} Note\n", + ":class: note\n", + "\n", + "AWS Free Tier refers to several of the services that AWS offers to help users gain more hands on experience on the AWS platform without being charged. [Click here](https://aws.amazon.com/free/?all-free-tier.sort-by=item.additionalFields.SortRank&all-free-tier.sort-order=asc&awsf.Free%20Tier%20Types=*all&awsf.Free%20Tier%20Categories=*all) for more info about the AWS Free Tier [external link] . \n", + "```\n", + "\n", + "There are 7 steps to walk through to create a new EC2 instance; we will go through each in detail: \n", + "1. Select an AMI\n", + "2. Choose Instance Type\n", + "3. Configure Instance \n", + "4. Add Storage\n", + "5. Add Tags\n", + "6. Configure Security Group\n", + "7. Review/Launch" + ] + }, + { + "cell_type": "markdown", + "id": "b9809503", + "metadata": {}, + "source": [ + "## Select an AMI (Step 1)\n", + "\n", + "An Amazon Machine Image (AMI) is a template that Amazon uses to describe the operating system, disk type and all the software configuration that is needed to make sure a computer runs smoothly. Imagine that you are purchasing a new laptop; fresh out of the box, the laptop is pre-configured with an operating system (e.g. Windows, Mac OS, Ubuntu etc.), configuration files that tells the laptop what peripherals are attached, and pre-installed software like Adobe PDF reader. An AMI contains all this information so that your EC2 instance runs exactly like it would a new laptop out of the box! There is much more to learn about AMIs and how they can used for collaboration and data sharing but that is not within the scope of CLASS Essentials. \n", + "\n", + "As you scroll through the AMI list (Figure 2) you will notice that the list contains offerings from various vendors (e.g. Amazon, RedHat, Windows, etc.). We will be choosing the Ubuntu operating system for flexibility and versatility (can be used outside of the AWS ecosystem). \n", + "\n", + "To list all the Free Tier AMIs, check the box on the right that says **Free tier only**.\n", + "\n", + "![ec2-ami](images/ec2-ami.png)\n", + "Step 1 - Select an AMI - Free Tier Only\n", + "\n", + "Scroll to `Ubuntu Server 20.04 LTS(HVM), SSD Volume Type` Select `64-bit(x86)`. \n", + "\n", + "![ec2-ubuntu](images/ec2-ubuntu.png)\n", + "Step 1 - Select an AMI - Operating System Selection" + ] + }, + { + "cell_type": "markdown", + "id": "9c658eed-3cf6-4f46-bde6-f3b481874013", + "metadata": { + "tags": [] + }, + "source": [ + "## Choose an Instance Type (Step 2)\n", + "\n", + "Choosing an instance type is choosing the hardware for your computing system: you get to pick the number of CPUs and memory size for your instance. \n", + "\n", + "Instance types are group by [**families**](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html) and denotes whether, for example, an instance is optimized for batch processing (compute-optimized, C-family), optimized for databases (memory-optimized, R-family) or has accelerated hardware (GPUs) for AI or Machine Learning pipelines. \n", + "\n", + "When you choose an Instance Type (below), the screen show additional information about the selected instance type including the number of CPUs, the memory size, the type of storage and information about networking. \n", + "![ec2-ubuntu](images/ec2-ubuntu.png)\n", + "\n", + "In the Instance Storage (GB) column, you will notice a term called **EBS**. EBS is the acronym for **Elastic Block Storage** and is analogous to the hard disk or boot drive on your personal computer or laptop. More details about EBS and different kinds of disk storage on EC2 instances are beyond the scope of CLASS Essentials. \n", + "\n", + "```{admonition} Note\n", + ":class: note\n", + "The four most common types of storage you will encounter on AWS are: Elastic Block Storage (EBS), Elastic File Storage (EFS), Simple Storage Service (s3) and s3 Glacier. In the simplest terms, EBS is analogous to a computer hard drive and EFS is analogous to a network file system (NFS) or shared file system. s3 is AWS's object storage which is discussed [here](03_intro_to_cloud_storage). s3 Glacier is a cost-effective way of storing s3 files that you do not need to access frequently. \n", + "```\n", + "\n", + "Here will will select a `t2.micro` instance which is Free Tier Eligible but only has 1vCPU and 1 GiB of memory. The cost of running a **t2.micro** instance is, at the time of publication, as follows: \n", + "\n", + "![Choose an Instance Type](images/ec2-type.png)\n", + "\n", + "Select **Next: Configure Instance Details**." + ] + }, + { + "cell_type": "markdown", + "id": "285aad80-5670-4bdf-b9c3-86439720e9e1", + "metadata": { + "tags": [] + }, + "source": [ + "## Configure Instance Details (Step 3)\n", + "Step 3 in creating an EC2 instance involves a rudimentary understanding of several key AWS and cloud jargon (Figure 4). While delving deeper into some of the terminology is outside of the scope of CLASS Essentials, we go will through these terms in brief as we learn how to configure your EC2 instance. For the most part, we will **leave the settings as default**. CLASS Intermediate offers a more in depth discussion on cloud concepts. \n", + "\n", + "![Configure Instance Details](images/ec2-configure.png)\n", + "\n", + "**Number of instances** : This indicates how many instances you want to create at the same time. Here, we will leave the value as '1' but in actuality, you can can have up to 20 instances per region. \n", + "\n", + "```{admonition} Note\n", + ":class: note\n", + "Recall that we learned about regions in the [previous chapter](01_intro_to_cloud_console). \n", + "```\n", + "\n", + "**Purchasing Options** : Throughout your AWS journey, you will hear the term **Spot Instances**. Spot instances make use of the servers that go unused in AWS data centers to minimize costs. Recall that AWS has many data centers spread across the globe and not all their servers are utilized at 100% capacity at all times. Amazon uses Spot Instances as a flexible way to profit from extra capacity. Users have access to Spot Instances through a bidding process, sometimes users can save up to 90% off the on-deman compute instance this way! We will not expand much more on Spot Instances in CLASS Essentials but if you are interested, I2's CLASS Intermediate talks more " + ] + }, + { + "cell_type": "markdown", + "id": "9c874bad", + "metadata": {}, + "source": [ + "```{admonition} Exercise\n", + ":class: attention\n", + "\n", + "* What kind of information is contained in an AMI? \n", + "* How do Spot Instances help you optimize costs?\n", + "````" + ] + }, + { + "cell_type": "markdown", + "id": "b36239c2-a76b-46e7-a495-d6da6e4598a4", + "metadata": {}, + "source": [ + "## Review Progress\n", + "\n", + "In the previous steps we learned how to launch a virtual machine from the AWS console. We selected an Amazon Machine Image (AMI), Chose an Instance and Configured Launch Settings. Recall that there are 7 steps to walk through to create a new EC2 instance; we will go through each in detail: \n", + "\n", + "1. Select an AMI\n", + "2. Choose Instance Type\n", + "3. Configure Instance \n", + "4. Add Storage\n", + "5. Add Tags\n", + "6. Configure Security Group\n", + "7. Review/Launch" + ] + }, + { + "cell_type": "markdown", + "id": "07b8ec13-c056-4236-ac14-12926bd7f872", + "metadata": {}, + "source": [ + "## Add Storage (Step 4)\n", + "\n", + "Storage on an EC2 instance is akin to a hard drive. Here we will leave the default settings but it is important to know that a hard drive on an EC2 instance is known as [Elastic Block Storage](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html). EBS volumes behave like raw, unformatted block devices.\n", + "\n", + "![ec2-storage](images/ec2-storage.png)" + ] + }, + { + "cell_type": "markdown", + "id": "a29c2a86-c864-493c-9e3f-0b4cced47dd9", + "metadata": {}, + "source": [ + "## Add Tags (Step 5)\n", + "\n", + "[Tags](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) are labels that you assign to an AWS resource. Each tag consists of a key and an optional value, both of which you define.Tags enable you to categorize your AWS resources in different ways, for example, by purpose, owner, or environment. e\n", + "\n", + "![ec2-tags](images/ec2-tags.png)" + ] + }, + { + "cell_type": "markdown", + "id": "45d695b3-c39b-4889-af48-a0bfb901cb32", + "metadata": {}, + "source": [ + "## Step 6: Configure Security Group (Step 6)\n", + "\n", + "A [security group](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html) acts as a virtual firewall for your EC2 instances to control inbound and outbound traffic. Again, we will not delve too much into networking protocols in CLASS Essentials. We will leave the default values of opening port 22 so that we can securely log in to the EC2 instance that we create. \n", + "\n", + "![ec2-sg](images/ec2-sg.png)" + ] + }, + { + "cell_type": "markdown", + "id": "5334a614-fb7f-409f-8aba-d1f18c92bc60", + "metadata": {}, + "source": [ + "## Step 7: Review Instance Launch\n", + "\n", + "Next review the details and click on **Launch**\n", + "![ec2-launch](images/ec2-launch.png)\n", + "\n", + "You will be prompted to generate a ssh-key to access the virtual machine. For now we will create a new one by entering `essentials-aws` in the key name and clicking **Download**\n", + "![ec2-sshkey](images/ec2-sshkey.png)\n", + "\n", + "You shoudl now see the following message\n", + "![ec2-confirm](images/ec2-confirm.png)\n", + "\n", + "Congratulations, you have created a virtual machine.\n", + "\n", + "```{admonition} Caution\n", + ":class: caution\n", + "\n", + "We will delete this virtual machine later. If you do not, **you will be charged for the running machine**.\n", + "```" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/content/AWS/02_intro_to_compute_part1.ipynb b/content/AWS/02_intro_to_compute_part1.ipynb index b18baa6..07c12d4 100644 --- a/content/AWS/02_intro_to_compute_part1.ipynb +++ b/content/AWS/02_intro_to_compute_part1.ipynb @@ -158,10 +158,60 @@ "metadata": {}, "source": [] }, + { + "cell_type": "markdown", + "id": "ce945b0d", + "metadata": {}, + "source": [ + "## Step 4. Add Storage\n", + "\n", + "Storage on an EC2 instance is akin to a hard drive. Here we will leave the default settings but it is important to know that a hard drive on an EC2 instance is known as [Elastic Block Storage](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html). EBS volumes behave like raw, unformatted block devices.\n", + "\n", + "" + ] + }, + { + "cell_type": "markdown", + "id": "55f4f9af", + "metadata": {}, + "source": [ + "## Step 5: Add Tags\n", + "\n", + "[Tags](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) are labels that you assign to an AWS resource. Each tag consists of a key and an optional value, both of which you define.Tags enable you to categorize your AWS resources in different ways, for example, by purpose, owner, or environment. e\n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "id": "bd0b7892", + "metadata": {}, + "source": [ + "## Step 6: Configure Security Group\n", + "\n", + "A [security group](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html) acts as a virtual firewall for your EC2 instances to control inbound and outbound traffic. Again, we will not delve too much into networking protocols in CLASS Essentials. We will leave the default values of opening port 22 so that we can securely log in to the EC2 instance that we create. \n", + "\n", + "" + ] + }, + { + "cell_type": "markdown", + "id": "d4b441c6", + "metadata": {}, + "source": [ + "## Step 7: Review Instance Launch\n", + "\n", + "\n", + "\n", + "\n", + "\n", + "" + ] + }, { "cell_type": "code", "execution_count": null, - "id": "fff35db8", + "id": "1e918e55", "metadata": {}, "outputs": [], "source": [] diff --git a/content/AWS/04_intro_to_cloud_storage.ipynb b/content/AWS/03_intro_to_cloud_storage.ipynb similarity index 76% rename from content/AWS/04_intro_to_cloud_storage.ipynb rename to content/AWS/03_intro_to_cloud_storage.ipynb index 43d669f..cbb04cf 100644 --- a/content/AWS/04_intro_to_cloud_storage.ipynb +++ b/content/AWS/03_intro_to_cloud_storage.ipynb @@ -32,10 +32,11 @@ "id": "338a2a01", "metadata": {}, "source": [ - "There are three types of [cloud data storage](https://aws.amazon.com/what-is-cloud-storage/): object storage, file storage, and block storage. In this module, we will focus on object storage (e.g. Amazon Simple Storage Service (S3)).\n", + "There are three types of [cloud data storage](https://aws.amazon.com/what-is-cloud-storage/): object storage, file storage, and block storage. In this module, we will focus on object storage (e.g. Amazon Simple Storage Service (S3)). Object storage is a technology that manages data as objects. All data is stored in one large repository which may be distributed across multiple physical storage devices, instead of being divided into files or folders.\n", "\n", - "Recall that there are multiple ways to locate an AWS service: Using the search bar and using the home button at the top left hand of the screen. Here, we will search for the service **s3**. \n", + "# Creating a bucket\n", "\n", + "Recall that there are multiple ways to locate an AWS service: Using the search bar and using the home button at the top left hand of the screen. Here, we will search for the service **s3**. \n", "\n", "\n", "" @@ -46,7 +47,7 @@ "id": "177860a7", "metadata": {}, "source": [ - "Here we will click into the s3 service page. Note that the region here is Global. s3 namespaces, meaning the name of the buckets are global, which means that no two buckets can have the same name even if they reside in a different region. \n", + "Here we will click into the s3 service page. Note that the region here is Global. s3 namespaces(the name of the buckets) are global. This means that no two buckets can have identical names even if they reside in a different regions. \n", "\n", "Click ```Create Bucket```. \n", "\n", @@ -68,13 +69,23 @@ "id": "8c3eca82", "metadata": {}, "source": [ + "When your bucket is successfully created, you will see it pop up in the s3 console. \n", + "\n", "" ] }, + { + "cell_type": "markdown", + "id": "4a8c60bb", + "metadata": {}, + "source": [ + "In the next lesson, we will learn about the AWS CLI and how we can use that to manipulate both the EC2 and s3 bucket we have created. " + ] + }, { "cell_type": "code", "execution_count": null, - "id": "8a8b8f92", + "id": "136d902c", "metadata": {}, "outputs": [], "source": [] diff --git a/content/AWS/03_intro_to_compute_part2.ipynb b/content/AWS/03_intro_to_compute_part2.ipynb deleted file mode 100644 index 60316dc..0000000 --- a/content/AWS/03_intro_to_compute_part2.ipynb +++ /dev/null @@ -1,99 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "502f2360", - "metadata": {}, - "source": [ - "In the previous lesson we learned how to launch a virtual machine from the AWS console. We selected an Amazon Machine Image (AMI), Chose an Instance and Configured Launch Settings. Recall that there are 7 steps to walk through to create a new EC2 instance; we will go through each in detail: \n", - "\n", - "1. Select an AMI\n", - "2. Choose Instance Type\n", - "3. Configure Instance \n", - "4. Add Storage\n", - "5. Add Tags\n", - "6. Configure Security Group\n", - "7. Review/Launch" - ] - }, - { - "cell_type": "markdown", - "id": "b9809503", - "metadata": {}, - "source": [ - "## Step 4. Add Storage\n", - "\n", - "Storage on an EC2 instance is akin to a hard drive. Here we will leave the default settings but it is important to know that a hard drive on an EC2 instance is known as [Elastic Block Storage](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/AmazonEBS.html). EBS volumes behave like raw, unformatted block devices.\n", - "\n", - "" - ] - }, - { - "cell_type": "markdown", - "id": "17597535", - "metadata": {}, - "source": [ - "## Step 5: Add Tags\n", - "\n", - "[Tags](https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/Using_Tags.html) are labels that you assign to an AWS resource. Each tag consists of a key and an optional value, both of which you define.Tags enable you to categorize your AWS resources in different ways, for example, by purpose, owner, or environment. e\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "id": "4ee655a3", - "metadata": {}, - "source": [ - "## Step 6: Configure Security Group\n", - "\n", - "A [security group](https://docs.aws.amazon.com/vpc/latest/userguide/VPC_SecurityGroups.html) acts as a virtual firewall for your EC2 instances to control inbound and outbound traffic. Again, we will not delve too much into networking protocols in CLASS Essentials. We will leave the default values of opening port 22 so that we can securely log in to the EC2 instance that we create. \n", - "\n", - "" - ] - }, - { - "cell_type": "markdown", - "id": "5235bac7", - "metadata": {}, - "source": [ - "## Step 7: Review Instance Launch\n", - "\n", - "\n", - "\n", - "\n", - "\n", - "" - ] - }, - { - "cell_type": "code", - "execution_count": null, - "id": "113ba95a", - "metadata": {}, - "outputs": [], - "source": [] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.5" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/content/AWS/04_intro_to_cli.ipynb b/content/AWS/04_intro_to_cli.ipynb new file mode 100644 index 0000000..25635c1 --- /dev/null +++ b/content/AWS/04_intro_to_cli.ipynb @@ -0,0 +1,194 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "dc57021c", + "metadata": {}, + "source": [ + "# Introduction to the AWS CLI\n", + "\n", + "\n", + "```{admonition} Overview\n", + ":class: tip\n", + "\n", + "**Teaching: 45 mins**\n", + "\n", + "**Exercises: 10 mins**\n", + "\n", + "**Questions:**\n", + "* How do I use the AWS CLI?\n", + "\n", + "**Objectives:**\n", + "* Understand when and how to use the AWS CLI \n", + "* Understand basic AWS CLI commands to provision resources\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "8e8dd80c", + "metadata": {}, + "source": [ + "# The AWS CloudShell\n", + "\n", + "Now that we have successfully created an EC2 Instance and an s3 bucket, we will explore ways to interact with these two AWS resources using the AWS Command Line Interface (CLI). The AWS Command Line Interface (CLI) is a unified tool to manage your AWS services. With just one tool to download and configure, you can control multiple AWS services from the command line and automate them through scripts.\n", + "\n", + "AWS CloudShell is a browser-based shell that makes it easy to securely manage, explore, and interact with your AWS resources. With CloudShell, you can quickly run scripts with the AWS Command Line Interface (AWS CLI). You can use CloudShell right from your browser and at no additional cost. \n", + "\n", + "While your s3 bucket from the previously lesson is launching, we will navigate to the AWS CloudShell. You can find it in the top toolbar of the console. Clicking the icon will launch the AWS CloudShell. \n", + "\n", + "If this is your first time using the cloud console, you may encounter a pop up. It is fine to dismiss it. \n", + "\n", + "Once we have launched the CloudShell, we can run some commands. Here a fundamental knowledge of unix commands may be useful but we will utilize the several aws-cli commands to help you get a feel of what the AWS CLI can do. At the prompt (the prompt is where is says [cloudshell-user@ip-XXXXXXX~]$), we will test out some commands. \n", + "\n", + "To check which file directory you are working in:\n", + "\n", + "```bash\n", + "pwd\n", + "\n", + "```\n", + "> /home/cloudshell-user\n" + ] + }, + { + "cell_type": "markdown", + "id": "dd9503b3", + "metadata": {}, + "source": [ + "# AWS CLI and s3 buckets\n", + "\n", + "\n", + "Let's now use the the AWS CLI command to list your s3 buckets. You will see the bucket that you created in the previous episode listed. Note that the XXXXXXX in bucket-userXXXXXXXX denotes your individual user ID that you used to create your s3 bucket. \n", + "\n", + "\n", + "```bash\n", + "aws s3 ls\n", + "\n", + "```\n", + "> 2022-02-04 06:31:43 bucket-userXXXXXXX\n", + "\n", + "Let's list the contents of your s3 bucket:\n", + "\n", + "```bash\n", + "aws s3 ls s3://bucket-userXXXXXXX\n", + "\n", + "```\n", + "> \n", + "\n", + "Looks like there is nothing there right now. So let us create a text file called `hemingway.txt` and populate it with a nonsensical quote. \n", + "\n", + "```bash\n", + "echo \"The world breaks everyone\" > hemingway.txt\n", + "```\n", + "\n", + "Let's check the contents of the file: \n", + "\n", + "```bash\n", + "cat hemingway.txt\n", + "```\n", + "> The world breaks everyone\n", + "\n", + "Great! Now we have a file to work with. Let's move the file to your s3 bucket using this command:\n", + "\n", + "```bash\n", + "aws s3 mv ./hemingway.txt s3://bucket-userXXXXXXX\n", + "```\n", + "\n", + "Then we'll list the contents of your CloudShell home directory just to see what's going on. \n", + "```bash\n", + "ls\n", + "```\n", + "> \n", + "\n", + "Looks like there's nothing there again. Have no fear, we merely moved your file into your s3 bucket. Let's try listing the contents of your s3 bucket now. \n", + "```bash\n", + "aws s3 ls s3://bucket-userXXXXXXX\n", + "```\n", + "> 2022-02-04 06:45:30 26 hemingway.txt\n", + "\n", + "\n", + "```{admonition} Note\n", + "\n", + "mv stands for move. mv is used to move one or more files or directories from one place to another in a file system like UNIX. cp stands for copy and is used to copy one or more files or directories from one place to another.\n", + "```\n", + "\n", + "```{admonition} Exercise\n", + ":class: attention\n", + "How would you copy the hemingway.txt file from the s3 bucket back to your CloudShell? \n", + "```\n", + "\n", + "```{dropdown} Answer\n", + "\n", + "aws s3 cp s3://bucket-userXXXXXXX/hemingway.txt .\n", + "\n", + "```\n", + "\n", + "In the next episode, you will learn how to utilize the AWS CLI within an EC2 instance and use that to create a fun research workflow!" + ] + }, + { + "cell_type": "markdown", + "id": "9ed2bb8f", + "metadata": {}, + "source": [ + "# AWS CLI and EC2\n", + "\n", + "Now we will exit the CloudShell and explore a different way to access your virtual machines with the AWS CLI. \n", + "\n", + "Let's navigate back to the EC2 console. We can do this by navigating to the bento menu icon at the top of the navigation bar. \n", + "\n", + "\n" + ] + }, + { + "cell_type": "markdown", + "id": "67225c9c", + "metadata": {}, + "source": [ + "Once you are on the EC2 console, select your instance by clicking on the checkbox. The `Connect` button is at the top of the screen. Click on the connect button. \n", + "\n", + "\n", + "\n", + "That should bring you to a page that looks something like this: \n", + "\n", + "\n", + "\n", + "When you click connect, you will be connected to your EC2 instance via a secure shell tunnel!\n", + "\n", + "\n", + "```{admonition} Note\n", + "SSH or Secure Shell is a network communication protocol that enables two computers to communicate\n", + "```\n" + ] + }, + { + "cell_type": "code", + "execution_count": null, + "id": "415774fe", + "metadata": {}, + "outputs": [], + "source": [] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/content/AWS/05_intro_to_cli.ipynb b/content/AWS/05_intro_to_cli.ipynb deleted file mode 100644 index d66a8d0..0000000 --- a/content/AWS/05_intro_to_cli.ipynb +++ /dev/null @@ -1,137 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "dc57021c", - "metadata": {}, - "source": [ - "# Introduction to the AWS CLI\n", - "\n", - "\n", - "```{admonition} Overview\n", - ":class: tip\n", - "\n", - "**Teaching: 30 mins**\n", - "\n", - "**Exercises: 10 mins**\n", - "\n", - "**Questions:**\n", - "* How do I use the AWS CLI?\n", - "\n", - "**Objectives:**\n", - "* Understand when and how to use the AWS CLI \n", - "* Understand basic AWS CLI commands to provision resources\n", - "```" - ] - }, - { - "cell_type": "markdown", - "id": "8e8dd80c", - "metadata": {}, - "source": [ - "Now that we have successfully created an EC2 Instance and an s3 bucket, we will explore ways that these two AWS resources can interact. While your s3 bucket from the previously lesson is launching, we will navigate to the AWS CloudShell. You can find in the top toolbar of the console. \n", - "\n", - "Clicking the icon will launch the AWS CloudShell. \n", - "\n", - "If this is your first time using the cloud console, you may encounter a pop up. It is fine to dismiss it. \n", - "\n", - "Once we have launched the CloudShell, we can run some commands. Here a fundamental knowledge of unix commands may be useful but we will utilize the several aws-cli commands to help you get a feel of what the AWS CLI can do. At the prompt (the prompt is where is says [cloudshell-user@ip-XXXXXXX~]$), we will test out these commands:\n", - "\n", - "To list the contents: \n", - "\n", - "``` bash\n", - "ls\n", - "\n", - "```\n", - "\n", - "To check which file directory you are working in:\n", - "\n", - "```bash\n", - "pwd\n", - "\n", - "```\n", - "\n", - "To use the AWS command to list your s3 buckets:\n", - "\n", - "```bash\n", - "aws s3 ls\n", - "\n", - "```\n", - "\n", - "Let's list the contents of your s3 bucket:\n", - "\n", - "```bash\n", - "aws s3 ls s3://bucketname\n", - "\n", - "```\n", - "\n", - "Looks like there is nothing there right now. So let us create a text file called `hemingway.txt` and populate it with a nonsensical quote. \n", - "\n", - "```bash\n", - "cat > hemingway.txt\n", - "The world breaks everyone. \n", - "```\n", - "\n", - "Press ^C to exit edit mode. \n", - "\n", - "Now let's move the file into our s3 bucket. \n", - "\n", - "```bash\n", - "aws s3 mv ./hemingway.txt s3://bucketname\n", - "\n", - "```\n", - "\n", - "\n" - ] - }, - { - "cell_type": "markdown", - "id": "9ed2bb8f", - "metadata": {}, - "source": [ - "" - ] - }, - { - "cell_type": "markdown", - "id": "9a85993e", - "metadata": {}, - "source": [ - "```{admonition} Exercise\n", - ":class: attention\n", - "\n", - "* How can you see the contents of your bucket through the AWS console? \n", - "````" - ] - }, - { - "cell_type": "markdown", - "id": "c27cdc13", - "metadata": {}, - "source": [ - "# Using the CLI to access resources" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.9.5" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/content/AWS/05_running_analysis.ipynb b/content/AWS/05_running_analysis.ipynb new file mode 100644 index 0000000..dc901b2 --- /dev/null +++ b/content/AWS/05_running_analysis.ipynb @@ -0,0 +1,87 @@ +{ + "cells": [ + { + "cell_type": "markdown", + "id": "dc57021c", + "metadata": {}, + "source": [ + "# Putting It All Together\n", + "\n", + "\n", + "```{admonition} Overview\n", + ":class: tip\n", + "\n", + "**Teaching:**\n", + "\n", + "**Exercises:**\n", + "\n", + "**Questions:**\n", + "\n", + "**Objectives:**\n", + "\n", + "```" + ] + }, + { + "cell_type": "markdown", + "id": "67ef6891", + "metadata": {}, + "source": [ + "# AWS CLI and EC2\n", + "\n", + "Now we will exit the CloudShell and explore a different way to access your virtual machines with the AWS CLI. \n", + "\n", + "Let's navigate back to the EC2 console. We can do this by navigating to the bento menu icon at the top of the navigation bar. \n", + "\n", + "\n", + "\n", + "Once you are on the EC2 console, select your instance by clicking on the checkbox. The `Connect` button is at the top of the screen. Click on the connect button. \n", + "\n", + "\n", + "\n", + "That should bring you to a page that looks something like this: \n", + "\n", + "\n", + "\n", + "When you click connect, you will be connected to your EC2 instance via a secure shell tunnel!\n", + "\n", + "\n", + "```{admonition} Note\n", + "SSH or Secure Shell is a network communication protocol that enables two computers to communicate\n", + "```\n", + "\n", + "Your virtual machine does not come pre-loaded with bells and whistles, so the first order business is making sure that it has the tools it needs for us to do some fun stuff. We will get the necessary updates and upgrades for the operating system. \n", + "\n", + "```bash\n", + "sudo apt update | sudo apt upgrade\n", + "```\n", + "\n", + "You will be prompted to install a whole slew of packages. Go ahead and press `Y` if prompted. This process may take a few minutes. \n", + "\n", + "\n", + "\n" + ] + } + ], + "metadata": { + "kernelspec": { + "display_name": "Python 3", + "language": "python", + "name": "python3" + }, + "language_info": { + "codemirror_mode": { + "name": "ipython", + "version": 3 + }, + "file_extension": ".py", + "mimetype": "text/x-python", + "name": "python", + "nbconvert_exporter": "python", + "pygments_lexer": "ipython3", + "version": "3.9.5" + } + }, + "nbformat": 4, + "nbformat_minor": 5 +} diff --git a/content/AWS/06_running_analysis.ipynb b/content/AWS/06_running_analysis.ipynb deleted file mode 100644 index 485cae8..0000000 --- a/content/AWS/06_running_analysis.ipynb +++ /dev/null @@ -1,47 +0,0 @@ -{ - "cells": [ - { - "cell_type": "markdown", - "id": "dc57021c", - "metadata": {}, - "source": [ - "# Putting It All Together\n", - "\n", - "\n", - "```{admonition} Overview\n", - ":class: tip\n", - "\n", - "**Teaching:**\n", - "\n", - "**Exercises:**\n", - "\n", - "**Questions:**\n", - "\n", - "**Objectives:**\n", - "\n", - "```" - ] - } - ], - "metadata": { - "kernelspec": { - "display_name": "Python 3 (ipykernel)", - "language": "python", - "name": "python3" - }, - "language_info": { - "codemirror_mode": { - "name": "ipython", - "version": 3 - }, - "file_extension": ".py", - "mimetype": "text/x-python", - "name": "python", - "nbconvert_exporter": "python", - "pygments_lexer": "ipython3", - "version": "3.7.10" - } - }, - "nbformat": 4, - "nbformat_minor": 5 -} diff --git a/content/AWS/images/cli_image_2.png b/content/AWS/images/cli_image_2.png new file mode 100644 index 0000000..f4a8584 Binary files /dev/null and b/content/AWS/images/cli_image_2.png differ diff --git a/content/AWS/images/cli_image_3.png b/content/AWS/images/cli_image_3.png new file mode 100644 index 0000000..aa0e1a4 Binary files /dev/null and b/content/AWS/images/cli_image_3.png differ diff --git a/content/AWS/images/cli_image_4.png b/content/AWS/images/cli_image_4.png new file mode 100644 index 0000000..69adf0a Binary files /dev/null and b/content/AWS/images/cli_image_4.png differ diff --git a/content/AWS/images/cli_image_5.png b/content/AWS/images/cli_image_5.png new file mode 100644 index 0000000..8b5f79a Binary files /dev/null and b/content/AWS/images/cli_image_5.png differ diff --git a/content/AWS/images/cloudshell.png b/content/AWS/images/cloudshell.png new file mode 100644 index 0000000..bc22f5e Binary files /dev/null and b/content/AWS/images/cloudshell.png differ diff --git a/content/AWS/images/console-cloudshell.png b/content/AWS/images/console-cloudshell.png new file mode 100644 index 0000000..0e713ae Binary files /dev/null and b/content/AWS/images/console-cloudshell.png differ diff --git a/content/AWS/images/s3_launch_2 2.png b/content/AWS/images/s3_launch_2 2.png new file mode 100644 index 0000000..290a91e Binary files /dev/null and b/content/AWS/images/s3_launch_2 2.png differ diff --git a/content/AWS/images/s3_launch_2.png b/content/AWS/images/s3_launch_2.png index a1910c0..0dabc2d 100644 Binary files a/content/AWS/images/s3_launch_2.png and b/content/AWS/images/s3_launch_2.png differ