Conteúdo do Curso
Introdução à Computação em Nuvem
Introdução à Computação em Nuvem
Armazenando Fragmentos de Código no AWS S3
In the previous chapter, we wrote HTML code that allows us to feed the turtle, and in this code, we used an image that we uploaded to AWS S3 in a public bucket. But you may have noticed that reading the code from there was quite inconvenient due to the large number of styles.
I'm leading up to the fact that we can also upload certain code snippets to AWS S3, just like images. For example, in our case, it would be convenient to upload CSS styles for our HTML pages or applications to AWS in order to save space in the code.
Let's take a look at the style file I want to upload to the storage:
index.css
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:
No caso de vincular aos nossos estilos, esta linha ficará assim:
Vamos ver quanto nosso código será reduzido após nossas mudanças e como ele ficará agora:
index.html
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.
script.js
Now, we need to use the following syntax to add the script to the code via the link:
Após adicionar o script do AWS S3, nosso código para a tartaruga ficará assim:
Nota
A propósito, você pode mais uma vez visualizar o script diretamente via o link.
index.html
Obrigado pelo seu feedback!