The Ec2 instances are the actual Unix operating systems that you would be running in your environment. Amazon AWS provides you with flexibility with customizing the instances according to your need from selecting the instance types to the images so you always not need to start from scratch and load the Unix systems from starting and instead you can create the images and boot them directly which would be exact replica that you created initially or might be you consider using the community images as well.
Follow the steps to create an Ec2 instance under the Default VPC
1. Select the Ec2 from the Dashboard and select launch an EC2 instance.
2. Next it will provide you the option of the images that are prebuilt by the Amazon itself, so you won't have to install the OS separately and it will already be installed as soon as your instances comes up thus greatly reducing the time to create a server.
Follow the steps to create an Ec2 instance under the Default VPC
1. Select the Ec2 from the Dashboard and select launch an EC2 instance.
2. Next it will provide you the option of the images that are prebuilt by the Amazon itself, so you won't have to install the OS separately and it will already be installed as soon as your instances comes up thus greatly reducing the time to create a server.
- You can select the different distributions of Linux here and also displays the information of the hardware and software it supports.
- You also have an option to create your own AMIs which will come under My AMIs.
- you can select customized AMIs from the AWS Marketplace which are prebuilt by various technology providers and can cost you separately depending on the type of your requirement in addition to what Amazon charges you
- you may also select the community AMIs provided by the large community supporting the Amazon.
- For us we are going to select the Amazon Linux as it is flavour of RHEL only and comes with tools customized for AWS usage such as AWS command line tools, ruby , perl , java.
3. Next depending on the type of the environment in which you want to use the instance and kind of load and memory usage you expect from the application you need to select the instance type here. More the number of vcpu more load you instance can support, type memory consumption you expect, Storage type it would support, whether or not it is EBS optimized and network performance. The selection needs to be work out carefully depending upon the kind of requirement of your application needs and amount of traffic it is expected to receive.
4. Next you need to configure the subnet if its going to launch in public vpc or private vpc. public is selected by default and we are going to use the same to launch the ec2 instance. Next you need to select the AZ in which you want to launch the instance. we are going to launch is us-east-1a. IAM and shutdown behaviour will be default.Also you can select the Protect against accidental termination this won't let you terminate the instance and would prop a warning in such cases. You need to manually deselect it than only you can terminate the instance. This is preferable for the production instance.
Next under the advanced section you have an option to enter the user data. User data is the data you want to enter the ec2 instance and it would be applied to the instance during the boot time. You can enter the bash scripts, python or some other scripting language for the specific things you want that your instance should have once its booted up. In our case we going to create the /test1 directory just to test its functionality. once done click add storage.
5. Next you need to select the type of the storage (EBS) size and type you want to attach your instance. Once done click tag instance.
6. You can tag your instance here. It is always perferable to tag an instance so you would be able to find the instance in case you are running large number of instances in your infrastructure. You can tag instance with the application name so you can identify easily which instance is associated with which application. We will name it app-a once done click "Configure Security group"
7. Here you need to configure the security group you want your instance should belong to. Create a new security group with name app-a and appropriate description. Next you need to select the ports you want your instance to be open. Like you need 22 port to be able to ssh to your instance. Port 80 is required in case of webservers. We are going to open port 22 and port 80 for this instance normal webserver scenario. And specify the source , you can specify source from some particular vpc, your on premise ip etc. else you can make it public so you can connect from anywhere on the internet to do that you need to enter (0.0.0.0/0) which is public. It is best practice not to open your instance to world instead you should use some jump server only so that it can't be access from anywhere else as an additional security. Since we are just considering a test instance so we are going to open it from the world. Next click "Review and Launch"
8. Here you can have a final lookup to all the parameters you have configured for your EC2 instance. If you want to change something go backup and make appropriate changes and once done click Launch.
9. You need to select an key pair using which you would be able to connect to your instance. This is the only time you would be able to generate the key file , if you loose it you will need to change the key pair and generate a new key in order to connect to your instance.
10 This will launch your instance and you would see the details of the instance bootup initiated along with the id number and an option to look at the launch log. Click view instances to see your instance details.
11. Right on it and select terminate , you would see a warning page as shown below and you won't be able to select the Yes,Terminate option since you opted to provided protection against the accidental termination
12. Next click on the connect at the top and you would see the connect command you need to use to connect to your instance.
13. Enter the command in the terminal with the access key in the directory and you should be able to connect to your instance.
0 comments:
Post a Comment