Watching previous blogs doing great, all of you motivated me to write one more. Well, in my last post, I talked about AWS Cloud SDKs. This time, I’ll talk about Amazon Command Line Interface, a unified tool to manage your AWS services.
Configuring AWS Command Line Interface
Before getting started with this tool, you need to configure your AWS Command Line Interface. To do that, use the following command:
$ aws configure
This command will prompt AWS credentials, default region & output format. Once you have provided all the inputs, a config file is being created in the folder named .aws in your home directory.
AWS Access Key ID [None]: Your_AWS_Acces_Key AWS Secret Access Key [None]: Your_AWS_Secret_Key Default region name [None]: us-west-2 Default output format [None]: json
Creating a new Virtual Server using AWS Command Line Interface
It is really convenient for you to create an Instance (Virtual Server) using AWS Command Line Interface. All you have to do is to use the commands given below .
aws ec2 run-instances --image-id ami-xxxxxxxx --count 1 --instance-type t1.micro --key-name MyKeyPair --security-groups MySecurityGroup // image-id: the id of the AMI which is used to create an Instance. // count: number of instances you want to create // instance-type: size of the instance e.g, t1.micro, m1.small etc. // key-name: name of the the key-pair // security-groups: name of the created security-group // To create Security group aws ec2 create-security-group --group-name MySecurityGroup --description "My security group" // group-name: name of the security group // description: description about the security group // add rules to your created security group aws ec2 authorize-security-group-ingress --group-name MySecurityGroup --protocol tcp --port 22 --cidr x.x.x.x/24 // group-name: name of the security group // protocol: IP protocol of this permission e.g, tcp, udp, icmp // port: port to give permission on. // cidr: The CIDR IP address range. By default it is 0.0.0.0/0 (for all IPs)
Click here for more information on commands provided by EC2 CLI Tool.
In this post, I have explained the process for creating and managing Virtual Servers on Amazon using AWS Command Line Interface.
If you have queries or need any further assistance, write to us at firstname.lastname@example.org