Is it possible to create and manage resources on AWS without logging in to the AWS management Console? Yes, it is definitely possible and the answer is AWS CLI (Command Line Interface)
AWS CLI is a unified tool to manage your AWS Services. You can start using the tool after installing and doing a minimal configuration. The tool provides all the functionality provided by AWS Management Console. The tool can be installed and used on Windows, Linux or Mac. After installing the tool you can run the cli commands by utilizing shell such as Bash on Linux or PowerShell or Windows Command Line on Microsoft Windows.
Hi @Hannah, the best way to install AWS CLI on Mac is by using the bundled installer as it includes all the dependencies and you can even use it offline. Execute the following command.
Installing AWS CLIWINDOWS
You can install AWS CLI on Windows with an installer
Run the downloaded installer and follow the instructions that appear.
LINUX, mac OS or UNIX
To install AWS CLI on Linux, macOS or Unix make sure you have a working version of Python 2 version 2.6.5+ or Python 3 version 3.3+
Download and run the installation script from the pip website
curl “https://bootstrap.pypa.io/get-pip.py” -o “get-pip.py”
python get-pip.py –user
Install AWS CLI using PIP
pip install awscli –user
How to create the Security Credentials
Inorder to use aws cli tool you have to configure it. The configuration requires AWS Access Key ID and Secret Access Key. Each user who has access to AWS requires his own AWS Access keys in order to use AWS CLI tools. You can also use the Access keys to make direct HTTP calls using the APIs for the individual AWS services.
Note: Do not use the root user ID to access AWS resources. The root user has all access to the AWS resources.
Create a New User
To create a new user, login to AWS Management Console as root user (or the account level user. This user has all access.) After login you can use IAM (Identity and Access Management ) service to create users with restricted access.
Select the option Create individual IAM Users and select Manage Users.
Download Aws Cli
Click Add User to create a new user. You have to enter user name and select the AWS access type required. You have to select programmatic access, since the user should be able to access the aws resources using the CLI. Click on Next:Permissions button to provide the required permission to the user.
Set Permissions
In order to set the permissions, you can do one of the following:
Note: Screen shot shows the groups that i have created, you can create your own group as required.
I will consider EC2 service as an Example to show the use of CLI in this article. I will make the new user a member of the developer group. The group has full access to Amazon EC2. This is indicated by the permissionAmazonEC2FullAccess. Click on CreateUser button to create the user. Select the newly created user and go to the Security Credentials tab. Click on Create Access Key to create a new set of secret keys for the user.
You can note that this user cannot login to the console as his password is disabled. Every resource that you create on AWS including the users that you create has its own unique resource name called ARN (Amazon Resource Name).
Download the CSV file. This file contains the Access Key ID and the Secret access key. This information is required to configure the CLI tool.
Note: Store the downloaded CSV file in a safe location. This is the only time you can view the secret keys or download the CSV file containing these keys. You cannot get this information again. If required, you can create a new access key at any time. You are allowed to have only two access keys for any user
Configure AWS CLI
You can download the csv file and use it to configure CLI by running the following command in the terminal window on linux (Power shell or command prompt on windows). Use the details in the CSV file to provide Access Key Id, Secret Access Key, Default region name and Default output format
$ aws configure
AWS Access Key ID [None] : AKIAIOSFODNN7EXAMPLEKEYID AWS Secret Access Key [None] : wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY Default region name [None] : us-west-2 Default output format [None] : json What is a Region?
AWS provides its services from several different regions. Each region is a separate geographical area and each region is completely independent. You can select a specific region after login to AWS Console.
Note: Some of the services may not be available in some regions
What is an Availability Zone?
Each region has multiple isolated locations known as availability zone. AWS allows you to place your resources (Like EC2 virtual machine instances, data) in multiple locations. The resources will not be replicated across regions unless you do it specifically. Each availability zone is isolated, but the Availability Zones in a region are connected through low latency links. The following diagram illustrates the relationship between regions and availability zones.
Output Format
You can set the output of any command that you execute to display in Json (JavaScript Object Notation), Text or Table format.If you do not specify an output format JSON will be used as default.
General AWS Command Syntax
Now your CLI tool is configured and you can execute commands to manage your AWS resources. You can refer to the AWS CLI Command Reference for a complete list of commands. Also you can refer to this documentation to find out what services are supported by CLI.
The general aws command syntax is
$ aws <command> <sub-command> [options and parameters]
where each command begins with the word aws. The next part is the command. The command is usually an AWS service supported by CLI. Each service has additional sub command that specify the operation to be performed in that service. Options and parameters indicate the general CLI options or specific parameters of an operation.They can be specified on the command line in any order.
Some EC2 Commandsdescribe-instances
This command provides you information of one or more EC2 instances based on the instance IDs specified. This command requires a parameter instance id. You can provide multiple instance ids if you want to get the details of all those vm instances.
$ aws ec2 describe-instances –instance-id i-0408b622aa5658683
You can see that the JSON output shows the details of the virtual machine instance like the public IP (an IP address which is reachable over the Internet), private IP (an IP address which is not reachable over the Internet), type of virtualization, type of VM instance (based on the amount of CPU,memory, storage and network capabilities of the VM), current state of the VM and several other properties.
You can display the same output in table form. This is achieved by changing the default output format to table in the aws configure command
stop-instances
You can use this command to stop an EBS backed instance. You have to provide instance id of the instance to be stopped or instance ids of multiple instances.
Every time you create a VM instance an EBS volume will be attached to your instance (The root volume). The size of this volume is 8GiB by default. You can have a bigger root volume if required. You can attach and mount additional volumes as and when required.
Note: You will be charged for EBS volume usage even when you stop your instance since the EBS volume is still connected to your instance.
$ aws ec2 stop-instances –instance-id i-0408b622aa5658683
You can run the describe-instances command with the same instance id to make sure that the instance has entered the stopped state
Conclusion
AWS CLI tools allow you to manage your aws resources. You can provide the required access for the resources you own to your users. This allows fine grained access to your aws resources without logging in to AWS management console. You can set the required permissions for each of the user using the IAM service. You can then create access keys for each user and provide the keys to the user. The user can configure CLI tools on his machine using these access keys. This allows the user to access your aws resources based on the permissions provided by you.
Did you like this article?. Don’t forget to mention your comments about this article.
-->
The Azure CLI is available to install in Windows, macOS and Linux environments. It can also be run in a Docker container and Azure Cloud Shell.
Install
The current version of the Azure CLI is 2.12.1. For information about the latest release, see the release notes. To find your installed version and see if you need to update, run
az --version .
Aws Cli On Mac![]()
Note
Aws Cli 2 Install
If you're using the Azure classic deployment model, install the Azure classic CLI.
Update
The CLI provides an in-tool command to update to the latest version:
Note
This command will also update all installed extensions by default. For more
az upgrade options, please refer to the command reference page.
Aws Cli 2Next StepsInstall Aws Cli Mac Os
See What is Azure CLI? for key characteristics.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
December 2020
Categories |