Skip to main content

Task 16: Introduction to Axios – The Superhero of HTTP Requests and Install the AWS CLI on Windows| How to Download & Set Up AWS CLI v2

Start with Affirmation​

  • "I am destined for greatness. Every step I take brings me closer to my goals. I embrace challenges, knowing they are stepping stones to success. My mind is focused, my heart is determined, and my actions are aligned with my dreams."

Daily Affirmations for Success

  • βœ… I am capable, confident, and unstoppable.
  • βœ… Success flows to me because I take consistent action.
  • βœ… I attract opportunities that align with my purpose.
  • βœ… My hard work and persistence create abundance.
  • βœ… I am always learning, growing, and evolving.
  • βœ… I believe in my potential and trust my journey.
  • βœ… I turn setbacks into comebacks with resilience.
  • βœ… I am grateful for every success, big and small.

Success Reflection​

"Every effort I made today has planted seeds for my future success. I release any doubts and trust the process. My dreams are possible, and I am getting closer every day. I am grateful, I am strong, and I am ready for more!"

πŸ’ͺ Repeat daily, feel the power, and watch your success unfold!


πŸ”Ή If you don’t understand the task, watch the video above for the answer.


Task​

βœ… What Axios is βœ… How to make a GET request βœ… How to handle .then() and .catch() βœ… How to POST data βœ… How Axios is different from fetch()

** Step 1: What is Axios?​

Axios is a JavaScript library that helps you make HTTP requests β€” like getting data from an API or sending info to a server."

🧠 It works in the browser and in Node.js. It’s like fetch(), but easier and with more features built-in.

πŸ’‘ We can include it in CodePen like this:

<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>

Step1​

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<title>Create New User with Axios</title>
</head>
<body>
<h1>πŸ‘€ Create New User</h1>

<button id="createUserBtn">Create User</button>

<h2 id="resultHeading" style="display: none;">βœ… New User Created:</h2>
<p><strong>Name:</strong> <span id="userName"></span></p>
<p><strong>Email:</strong> <span id="userEmail"></span></p>

<!-- Axios CDN -->
<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>

<!-- Link to JS file -->
<script src="script.js"></script>
</body>
</html>

Step 2​

// Get HTML elements
const createUserBtn = document.getElementById("createUserBtn");
const userNameSpan = document.getElementById("userName");
const userEmailSpan = document.getElementById("userEmail");
const resultHeading = document.getElementById("resultHeading");

// When button is clicked, create new user
createUserBtn.addEventListener("click", () => {
const newUser = {
name: "Enoch",
email: "[email protected]"
};

axios.post("https://jsonplaceholder.typicode.com/users", newUser)
.then(response => {
const user = response.data;
console.log("πŸ‘€ New User Created:", user);

// Show data on the page
userNameSpan.textContent = user.name;
userEmailSpan.textContent = user.email;
resultHeading.style.display = "block";
})
.catch(error => {
console.error("🚫 Error sending data:", error);
alert("Oops! Something went wrong while creating the user.");
});
});


Task​

Install the AWS CLI on Windows | How to Download & Set Up AWS CLI v2​

** Step 1: What is AWS CLI?​

The AWS Command Line Interface lets you control AWS services from your terminal or command prompt. Instead of clicking in the AWS Console, you can type commands and automate tasks β€” pretty cool, right?

Step 2: Download the Installer​

First, go to the official AWS CLI download page."

πŸ‘‰ Open your browser and go to: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html

Scroll to the Windows section and click the .msi installer link for 64-bit (most common).

Step 3: Run the Installer​

"Once it’s downloaded, double-click the .msi file to start the installer."

🧭 Follow the steps:

Click Next

Accept the License Agreement βœ…

Choose default install location

Click Install

Click Finish when done

You may need admin rights to install.

Step 4: Verify Installation​

Now let’s check if it installed correctly.

Open Command Prompt (Search 'cmd' in Start menu)

Type this command:

aws --version

Step 5: Configure AWS CLI (Optional for Later Use)​

If you have your AWS credentials ready, you can set them up using:

aws configure

It will ask you for:

AWS Access Key ID

AWS Secret Access Key

Default region name (like us-east-1)

Output format (json, text, or table)

Done! You're ready to use AWS CLI.

You've just installed and set up the AWS CLI on Windows. Now you can start using commands to manage your AWS services.