An instance is a virtual server in the AWS cloud. Points to note
- Instances are Amazon EBS-backed meaning that the root volume is an EBS volume
- The instance consists of the AZ (Availability Zone) a key pair and a security group
- An AMI (Amazon Machine Image) (think of it as a VM template) can be used to provision the instance – these can be either free (“Free tier eligible.”) or paid
- Instance Type can be chosen based on workload and cost (tier) (t2.micro)
- SG (Security Group) are flow rules that act like firewalls (explicit deny) this is an EC2 needed parameter when configuring an instance
- Changing an instance’s security groups changes the security groups associated with the primary network interface (eth0)
Default usernames and password for AMI’s
- For Amazon Linux 2 or the Amazon Linux AMI, the user name is ec2-user.
- For a Centos AMI, the user name is centos.
- For a Debian AMI, the user name is admin or root.
- For a Fedora AMI, the user name is ec2-user or fedora.
- For a RHEL AMI, the user name is ec2-user or root.
- For a SUSE AMI, the user name is ec2-user or root.
- For an Ubuntu AMI, the user name is ubuntu.
- Otherwise, if ec2-user and root don’t work, check with the AMI provider.
To connect to the AMI instance, you can use Putty/ssh or aws cli
#aws ec2 get-console-output --instance-id instance_id
Installing awscli on mac
Use “curl” to get the package to local machine
ayans-mbp:Desktop ayan$ curl "https://s3.amazonaws.com/aws-cli/awscli-bundle.zip" -o "awscli-bundle.zip"
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 10.8M 100 10.8M 0 0 2823k 0 0:00:03 0:00:03 --:--:-- 2823k
Unzip
ayans-mbp:Desktop ayan$ unzip awscli-bundle.zip
Archive: awscli-bundle.zip
inflating: awscli-bundle/install
inflating: awscli-bundle/packages/docutils-0.14.tar.gz
inflating: awscli-bundle/packages/python-dateutil-2.6.1.tar.gz
inflating: awscli-bundle/packages/urllib3-1.24.1.tar.gz
inflating: awscli-bundle/packages/jmespath-0.9.3.tar.gz
inflating: awscli-bundle/packages/argparse-1.2.1.tar.gz
inflating: awscli-bundle/packages/six-1.12.0.tar.gz
inflating: awscli-bundle/packages/ordereddict-1.1.tar.gz
inflating: awscli-bundle/packages/simplejson-3.3.0.tar.gz
inflating: awscli-bundle/packages/botocore-1.12.74.tar.gz
inflating: awscli-bundle/packages/awscli-1.16.84.tar.gz
inflating: awscli-bundle/packages/colorama-0.3.9.tar.gz
inflating: awscli-bundle/packages/python-dateutil-2.7.5.tar.gz
inflating: awscli-bundle/packages/virtualenv-15.1.0.tar.gz
inflating: awscli-bundle/packages/futures-3.2.0.tar.gz
inflating: awscli-bundle/packages/pyasn1-0.4.5.tar.gz
inflating: awscli-bundle/packages/s3transfer-0.1.13.tar.gz
inflating: awscli-bundle/packages/urllib3-1.22.tar.gz
inflating: awscli-bundle/packages/rsa-3.4.2.tar.gz
inflating: awscli-bundle/packages/PyYAML-3.13.tar.gz
inflating: awscli-bundle/packages/setup/setuptools_scm-1.15.7.tar.gz
Install the bundle
ayans-mbp:Desktop ayan$ sudo ./awscli-bundle/install -i /usr/local/aws -b /usr/local/bin/aws
Password:
Running cmd: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python virtualenv.py --no-download --python /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python /usr/local/aws
Running cmd: /usr/local/aws/bin/pip install --no-cache-dir --no-index --find-links file:///Users/ayan/Desktop/awscli-bundle/packages/setup setuptools_scm-1.15.7.tar.gz
Running cmd: /usr/local/aws/bin/pip install --no-cache-dir --no-index --find-links file:///Users/ayan/Desktop/awscli-bundle/packages awscli-1.16.84.tar.gz
You can now run: /usr/local/bin/aws --version
Now run aws cli
ayans-mbp:Desktop ayan$ aws
usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:
aws help
aws <command> help
aws <command> <subcommand> help
aws: error: too few arguments