You are currently viewing Getting Started with AWS Console & CLI
  • Post category:AWS
  • Post comments:0 Comments
  • Reading time:85 mins read

Using AWS CLI from Angular, React, Node.js, Java & C#


Part 1: What Is the AWS Console?

AWS Console is a web-based GUI to manage all your AWS services. You can:

  • Launch EC2 instances
  • Create S3 buckets
  • Manage IAM roles
  • Set up Lambda functions
  • …and much more

Use it when you want an intuitive, click-and-go interface.
Good for exploration, small tweaks, and visualization.

Visit: https://console.aws.amazon.com


Part 2: What Is the AWS CLI?

The AWS CLI (Command Line Interface) is a command-driven tool that allows you to control AWS services via terminal commands or scripts.

  • Best for automation
  • CI/CD pipelines
  • Scriptable infrastructure

Part 3: Installing AWS CLI

Mac/Linux/Windows

Install via:

ShellScript
curl "<a href="https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" target="_blank" rel="noreferrer noopener">https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip</a>" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

Or use a package manager like:

ShellScript
brew install awscli  # macOS
choco install awscli  # Windows

Configure

ShellScript
aws configure

You’ll be prompted to enter:

  • AWS Access Key ID
  • AWS Secret Access Key
  • Region
  • Output format (e.g., json)

Useful AWS CLI Examples

List S3 Buckets

ShellScript
aws s3 ls

Upload a file to S3

ShellScript
aws s3 cp ./file.txt s3://my-bucket-name/

Start an EC2 Instance

ShellScript
aws ec2 start-instances --instance-ids i-0123456789abcdef0

Part 4: Using AWS CLI in Code (via SDKs)

Let’s explore how different frontend & backend platforms can work with AWS via CLI or SDK.


Angular / React

Use Amplify or the AWS SDK via a backend proxy. Frontends can’t call the AWS CLI directly (security risk).

Option 1: Use Amplify in React

ShellScript
npm install aws-amplify
JavaScript
// App.js (React)
import Amplify from 'aws-amplify';
import awsExports from './aws-exports';

Amplify.configure(awsExports);

// Call a Lambda function
import { API } from 'aws-amplify';

API.get('myApi', '/items')
  .then(data => console.log(data))
  .catch(err => console.error(err));

Option 2: Use AWS CLI via a Backend API Proxy

ShellScript
# Backend does:
aws s3 cp ./input.json s3://my-bucket/input.json

Your frontend just makes HTTP calls to the backend.


Node.js

Use child_process to invoke CLI or use the SDK.

Option 1: AWS CLI from Node

JavaScript
const { exec } = require('child_process');

exec('aws s3 ls', (err, stdout, stderr) => {
  if (err) throw err;
  console.log(stdout);
});

Option 2: Use AWS SDK

ShellScript
npm install aws-sdk
JavaScript
const AWS = require('aws-sdk');
const s3 = new AWS.S3();

s3.listBuckets((err, data) => {
  if (err) console.error(err);
  else console.log(data.Buckets);
});

Java Example

Add dependency (Maven):

XML
<dependency>
  <groupId>software.amazon.awssdk</groupId>
  <artifactId>s3</artifactId>
  <version>2.25.13</version>
</dependency>

Code Example

Java
S3Client s3 = S3Client.builder().region(Region.US_EAST_1).build();
ListBucketsResponse buckets = s3.listBuckets();
buckets.buckets().forEach(b -> System.out.println(<a href="http://b.name/" target="_blank" rel="noreferrer noopener">b.name</a>()));

C# (.NET)

Install NuGet package:

ShellScript
dotnet add package AWSSDK.S3

Code Example

C#
var client = new AmazonS3Client();
var response = await client.ListBucketsAsync();

foreach (var bucket in response.Buckets)
{
    Console.WriteLine(bucket.BucketName);
}

Summary

PlatformApproachRecommended Tool/SDK
AngularAmplify, backend proxyAmplify / API Gateway
ReactAmplify, backend proxyAmplify / SDK
Node.jsCLI or SDKaws-sdk
JavaAWS SDK v2software.amazon.awssdk
C# / .NETAWS SDK for .NETAWSSDK.*

Final Tips

  • Use IAM Roles for permission management
  • Never expose AWS CLI/keys on the frontend
  • For frontend integration, prefer Cognito + API Gateway + Lambda
  • For automation, use AWS CLI + Bash/Node scripts
Please follow and like us:

Leave a Reply