Command Line Interface (CLI)
-
AWS API provides for communication with AWS throw HTTP/s calls
-
AWS API documentation available for many services
-
Utiilized by:
- AWS Management Console
- AWS Command Line Interface (CLI)
- AWS Software Development Kits (SDKs)
- Other AWS services.
-
API calls can only be made by valid security credentials:
- Console access - Account username and password
- CLI - IAM user access key ID and secret. IAM user downloads access key ID and secret to be able to issue CLI commands.
- SDKs - IAM temporary credentials. Your app may use google, facebook etc to authenticate external users e.g via Oauth2. Temporary Oauth2 credentails are thus issued by google, facebook etc. With such credentials you could have limited and temporary access to AWS cloud.
-
API calls can be logged cusing CloudTrail service.
AWS CLI Application
-
AWS CLI application is available for Windows, Mac, Linux. It allows API Commands to be sent to AWS using command line for Windows, terminal for Linux?Mac.
-
AWS Shell cross platform standalone integrated shell environment written in Python.
-
AWS Tools for Windows PowerShell
AWS Cloud9 IDE
-
An Integrated Development Environment (IDE) running on EC2 accessed throw the AWS Management Console.
-
AWS CLI application pre-installed
-
Increased security as IAM credentials are not saved on computer.
-
When used in conjuction with multi-factor authentication (MFA), account cannot be access with username and password only.
AWS CLI Usage
-
Management Console -> Services -> Cloud9 -> Create Environment
-
Add at least a name
-
Select: Create a new instance
- Select the type of instance
- Select the platform
- Select cost saving
-
The enviroment is created in a VPC
-
Settings -> Preferences -> Themes
Sample CLI commands via Cloud9 IDE
- Check if AWS CLI is installed:
$aws --version
- Create an s3 bucket named mybucket
$aws s3 mb s3://mybucket
- Copy a document named Notes.pdf to an s3 bucket named mybucket
Note: First upload the document named Notes.pdf to the Cloud9 directory
$aws s3 cp Notes.pdf s3://mybucket
- Delete the document named Notes.pdf from the s3 bucket named mybucket
$aws s3 rm s3://mybucket/Notes.pdf
Notes
-
Using AWS Cloud9 IDE service for sending CLI commands provides increased security because you don’t have to download credentials, thus reducing exposure. You may ask, what about the username and password used to connect to managment console… well you could enable multi-factor authentication on those.
-
Select cost saving when creating a Cloud9 environment EC2 instance. This saves cost by going into hibernation when the EC2 instance is not being used.
-
To view cli reference, browse to: aws.amazon.com/cli -> click CLI Reference
-
S3 api vs S3 commands - S3 api commands are far more in number, the commands are more verbose and powerful.
-
To delete a Cloud9 environment, Click on Cloud9 -> Select your environment -> Click delete.
Acronyms
- CLI - Command Line Interface
- SDK - Software Development Kits
- IDE - Integrated Development Environment
- MFA - Multi-factor Authentication
Links
-
Notes on AWS - Part 2 - Storages, Databases, Compute and Content Delivery
-
Notes on AWS - Part 3 - Management Tools, App Integration and Customer Engagement
-
Notes on AWS - Part 6 - Developer, Media, Mobile, Migration, Productivity, IoT and Gaming