Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Storing Code Fragments On AWS S3 | AWS S3 Overview
Introduction to Cloud Computing
course content

Course Content

Introduction to Cloud Computing

Introduction to Cloud Computing

1. Introduction to Cloud Technologies
2. AWS S3 Overview
3. EC2 Overview
4. RDS Management

book
Storing Code Fragments On AWS S3

We created some HTML code that lets us feed the turtle, and in this code, we used an image that we uploaded to AWS S3 in a public bucket. You might have noticed, though, that reading the code directly from there was quite inconvenient due to the large number of styles.

This leads us to the idea that we can also upload certain code snippets to AWS S3, just like we do with images. For example, in our case, it would be really convenient to upload CSS styles for our HTML pages or applications to AWS, helping us keep the code cleaner and more organized.

Let's take a look at the style file I want to upload to the storage:

css

index.css

copy

To add a file with styles to AWS S3, we first need to create the file and upload it to our public bucket:

To apply these CSS styles in your HTML code, you just need to use a straightforward syntax:

In the case of linking to our styles, this line will look like this:

Let’s take a look at how much our code will be reduced after these changes and how it will look now:

html

index.html

copy

If you click and follow this link, you'll see the contents of this file, specifically the styles I wrote earlier. This way, both we and the visitors to our website can view the styles stored on AWS and may want to borrow them from us.

It's also worth noting that we can upload JavaScript scripts to S3. While this is not the best practice because scripts often require editing and working with them, in our case, we are learning, so let’s go ahead and do it to further streamline our code!

Below is the script we'll be uploading to our public bucket:

js

script.js

copy

Now, we need to upload the JavaScript script file to our public bucket:

Now, we need to use the following syntax to add the script to the code via the link:

After adding the script from AWS S3, our code for the turtle will look like this:

html

index.html

copy

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 2. Chapter 5
We're sorry to hear that something went wrong. What happened?
some-alt