AMAZON WEB SERVICE USING (CLI)

Vivekkumarrullay
9 min readOct 14, 2020

AWS !!!

Amazon Web Services (AWS) is the world’s most comprehensive and broadly adopted cloud platform, offering over 175 fully featured services from data centers globally. Millions of customers including the fastest-growing startups, largest enterprises, and leading government agencies are using AWS to lower costs, become more agile, and innovate faster.

5 Key Characteristics of Amazon Web Services

  1. AWS offers a variety of services, all designed to deliver one set of functionality :- Each service stands alone, but you can mix and match them to meet the specific needs of your application.

2. Each service is, well, a service, offered via an API :- Some of you may choose to use Amazon’s or a third party’s user interface, while others may choose to access AWS directly via APIs or the AWS software development kit.

3. The AWS infrastructure is failure-prone, and Amazon achieves service robustness through redundancy :- For those services that Amazon offers service level agreements (SLAs), it commonly maintains three copies of the computing and data associated with a service.

4. AWS is offered on an on-demand, pay for what you use model. AWS can be a fantastic bargain, with very low costs when you’re first starting to develop an application. However, the meter is always running, so to speak, so it’s important to track what you use

5. AWS services are offered on a region- and availability zone-based partitioning. Accessing data in one region from EC2 instances in another imposes network traffic charges, so knowing where your data is located and your applications need to run is important if you want to keep costs down.

AWS Fundamentals :- Interacting with AWS

1. AWS Console

The AWS console is a web based GUI that provides the ability to interact with the services available within AWS. For example, I could use the console to launch an EC2 instance (i.e. a virtual machine), view information about that instance such as the IP address that has been assigned to that instance and then terminate that instance.

2. AWS CLI

The AWS console is a great way to get started with AWS and get up to speed with the services available, but once you start to get more familiar with the platform, you’re likely to find the console a bit limiting in terms of speed and repeatability. One of the more advanced ways in which you can interact with AWS is using the AWS CLI.

AWS SDKs

The real power of AWS lies in its programmability and ability to be automated. AWS provides a number of Software Development Kits (SDKs) that allow you to interact with the platform through code that you have developed yourself. SDKs are available for all the major programming languages, including Java, Python, Node.JS and Go.

WHY ?

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.

Installation Setup:

1. (For Windows): https://awscli.amazonaws.com/AWSCLIV2.msi

2. (For Linux): https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip

3. (For Mac): https://awscli.amazonaws.com/AWSCLIV2.pkg

Finally downloaded

After download the setup then check its working or not.

Press Windows key and R

Hit enter !!!

check the version

and type aws properly worked !!!

Task is :-

  1. Create a KEY-PAIR using CLI
  2. Create a Security-Group using CLI
  3. Launch an EC2 Instance using the above created KEY-Pair and Security Group
  4. Create an EBS Volume of 1 GB
  5. Finally, we have to attach the above created EBS volume to the Instance i.e. created in step 3

If you are beginner then some of basic terminology we know that !!

EC2 , IAM , SG , EBS , KEY PAIR >> START

EC2 INSTANCES :-Amazon Elastic Compute Cloud (Amazon EC2) provides scalable computing capacity in the Amazon Web Services (AWS) Cloud. Using Amazon EC2 eliminates your need to invest in hardware up front, so you can develop and deploy applications faster. You can use Amazon EC2 to launch as many or as few virtual servers as you need, configure security and networking, and manage storage. Amazon EC2 enables you to scale up or down to handle changes in requirements or spikes in popularity, reducing your need to forecast traffic.

IAM :- AWS Identity and Access Management (IAM) enables you to manage access to AWS services and resources securely. Using IAM, you can create and manage AWS users and groups, and use permissions to allow and deny their access to AWS resources. IAM is a feature of your AWS account offered at no additional charge. You will be charged only for use of other AWS services by your users.

KEY-PAIR :- You can use the AWS Command Line Interface (AWS CLI) to create, display, and delete your key pairs for Amazon Elastic Compute Cloud (Amazon EC2). You use key pairs to connect to an Amazon EC2 instance. You must provide the key pair to Amazon EC2 when you create the instance, and then use that key pair to authenticate when you connect to the instance.

SECURITY GROUPS

A security group acts as a virtual firewall for your instance to control inbound and outbound traffic. When you launch an instance in a VPC, you can assign up to five security groups to the instance. Security groups act at the instance level, not the subnet level. Therefore, each instance in a subnet in your VPC can be assigned to a different set of security groups.

EBS VOLUME

An Amazon EBS volume is a durable, block-level storage device that you can attach to your instances. After you attach a volume to an instance, you can use it as you would use a physical hard drive. EBS volumes are flexible. For current-generation volumes attached to current-generation instance types, you can dynamically increase size, modify the provisioned IOPS capacity, and change volume type on live production volumes.

Log in aws account >> Services >> IAM >> User >>Add user>>User name>>Programmatic access>>Next permission >>Attach existing policies directly>>Administrator access>>Next tags>>key name>>Next>>Download key>>Close.

And finally user was created. now go to cmd and type aws configure.

aws configure>> Access key >> Secret key>> Region name >> Name

Now we successfully Login to AWS Account

1. Now we have to create a key-pair because with key you won’t be able to start instances.

I have a key but now i want to create a key in CLI. Every bit I’ll show you.

You create a key using CLI then in top use cmd and the key is also show there and and in web UI portal I’ll show you . Successfully created key.

In there you check a key if you check a key in CLI then type a cmd in a command prompt.

2. Now create a Security Group

I have only two security group. if you create one more in CLI. then type this cmd I'll show you a cmd. Also check in Web UI

Successfully created Security group ID then we want to see that in our security group there is no inbound rules exist. Type cmd in CLI.

Also check in Web UI

If you check the inbound rules in CLI then type this cmd.

3. Now, we have to launch an EC2 Instance using the Key-Pair and the Security Group

I have only 3 instances but now i’ll show you how to launch a new instances using CLI. Successfully launch instance using CLI. and you check that in bottom the instance is pending. also check Web UI and now instance launched by CLI.

RUNNING STATE !!!

4. Now Create a EBS volume of 1 GB

I have a 4 volume but

Create one more EBS Volume of 1GB in AWS using CLI we use the command

Now, we see that we have successfully created volume of 1 GB

5. Now, Finally we have to attach the EBS Volume to the EC2 Instance that we created in the previous steps.

In EC2 Instance we see that we have only 10GB storage available

We want to attach our EBS Volume to this EC2 Instance using CLI . I’ll show you

And successfully volume attached in EC2 instance then i’ll show you very fast .

Thank you Connections to read that blog and also did that fastly !!!

VIVEK KUMAR

--

--