Who am I? <ul><li>Tahsin Hasan </li></ul><ul><li>Sr. software Engineer, </li></ul><ul><li>Tasawr Interactive. </li></ul><u...
Some Misconceptions  <ul><li>EC2 is expensive – False. </li></ul><ul><li>Only for large applications – False. </li></ul><u...
What is Amazon EC2? <ul><li>“ Amazon Elastic Compute Cloud(EC2) is a web service that provides resizable compute capacity ...
Why Amazon EC2? <ul><li>Create, launch and terminate as needed. </li></ul><ul><li>Buy computing power by the hour. </li></...
EC2 Data Centers <ul><li>Geographically dispersed- </li></ul><ul><ul><li>US West (North CA). </li></ul></ul><ul><ul><li>US...
Availability Zone
EC2 Instance Families <ul><li>Standard – Small, Large, Extra Large. </li></ul><ul><li>Micro.  </li></ul><ul><li>High-CPU –...
Amazon EC2 Instance Types <ul><li>Small – 1.7 GB memory, 160 GB storage. </li></ul><ul><li>Large – 7.5 GB memory, 850 GB s...
Amazon EC2 Instance Types <ul><li>High-Memory Extra Large – 17.1 GB memory, 480 GB instance. </li></ul><ul><li>High-Memory...
Amazon EC2 Free Tier <ul><li>Calculate each month usage for a year. </li></ul><ul><li>750 hours usage of micro instance an...
Getting Started with CLI <ul><li>Setting the Java Home variable. </li></ul><ul><li>export JAVA_HOME=<PATH>. </li></ul><ul>...
X.509 certificate <ul><li>Create X.509 certificate. </li></ul><ul><li>Create a directory named .ec2 in the home dir. </li>...
Import SSH Key Pair <ul><li>Either by OpenSSH or AWS mgmt console. </li></ul><ul><li>ec2-import-keypair phpXpert-keypair -...
Generate SSH key with AWS <ul><li>Create with Amazon mgmt console. </li></ul><ul><li>“ ec2-add-keypair phpXperts-keypair&q...
Tell Who You Are? <ul><li>$export EC2_PRIVATE_KEY=~/.ec2/pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem </li></ul><ul><li>$export...
Launch Instance
Launch an Instance: CLI <ul><li>$ec2-run-instances ami-3ac33653 -k gsg-keypair  </li></ul><ul><li>RESERVATION r-f25e6f9a 9...
Launch an Instance: API <ul><li>https://ec2.amazonaws.com/ ?Action=RunInstances &ImageId=ami-3ac33653 &MaxCount=1 &MinCoun...
Choose AMI
Community AMI <ul><li>Alestic.com </li></ul>
Start/Stop Instances: API <ul><li>https://ec2.amazonaws.com/ ?Action=StopInstances &InstanceId.1=i-10a64379 &...auth param...
Choosing Instance Types
Create a Key Pair
Create a Key Pair
Choose Security Group
Amazon EC2 Console
Public DNS
Connect to Instance <ul><li>ec2-get-console-output instance_id </li></ul><ul><li>ssh -i id_rsa-gsg-keypair root@ec2-67-202...
What about Security?
Security Groups
Security Group:CLI <ul><li>$ec2-authorize default -p 22 -s your-local-system's-public-ip-ad dress/32 PERMISSION default AL...
Security Group: API <ul><li>https://ec2.amazonaws.com/ ?Action=AuthorizeSecurityGroupIngress &GroupName=default &IpProtoco...
What is Elastic IP? <ul><li>Static IP address. </li></ul><ul><li>Associated with your account, not instances. </li></ul><u...
Elastic IP
Elastic IP
Terminate Instances
Start/Stop Instances with CLI <ul><li>ec2-stop-instances i-10a64379  </li></ul><ul><li>IMAGE i-10a64379 running stopping  ...
Tools <ul><li>Elasticfox – Firefox addons. </li></ul><ul><li>AWS toolkit for Eclipse. </li></ul>
Questions?
Upcoming SlideShare
Loading in …5
×

Setting Up Amazon EC2 server

2,647 views

Published on

Published in: Technology
  • Be the first to comment

  • Be the first to like this

Setting Up Amazon EC2 server

  1. 2. Who am I? <ul><li>Tahsin Hasan </li></ul><ul><li>Sr. software Engineer, </li></ul><ul><li>Tasawr Interactive. </li></ul><ul><li>[email_address] </li></ul><ul><li>Books - “Opencart 1.5 Template Design CookBook” and “Joomla 1.6 Mobile Development Beginners Guide” with Packt Publishers UK. </li></ul><ul><li>Website – tahSin’s gaRage (http://newdailyblog.blogspot.com). </li></ul>
  2. 3. Some Misconceptions <ul><li>EC2 is expensive – False. </li></ul><ul><li>Only for large applications – False. </li></ul><ul><li>Fully commercial – False. </li></ul><ul><li>Instances are not preserved when shutdown – False. </li></ul><ul><li>EC2 requires a proprietary OS – False. </li></ul>
  3. 4. What is Amazon EC2? <ul><li>“ Amazon Elastic Compute Cloud(EC2) is a web service that provides resizable compute capacity in the cloud.”- Amazon EC2 home page. </li></ul>
  4. 5. Why Amazon EC2? <ul><li>Create, launch and terminate as needed. </li></ul><ul><li>Buy computing power by the hour. </li></ul><ul><li>Buy bandwidth by the GB. </li></ul><ul><li>Buy space by the GB/month. </li></ul><ul><li>Add a firewall, load balancer, monitoring etc with the click of a mouse. </li></ul><ul><li>Rent virtual computers and peripherals. </li></ul><ul><li>Get start with a pre-configured images. </li></ul>
  5. 6. EC2 Data Centers <ul><li>Geographically dispersed- </li></ul><ul><ul><li>US West (North CA). </li></ul></ul><ul><ul><li>US East (North VA). </li></ul></ul><ul><ul><li>EU (Ireland). </li></ul></ul><ul><ul><li>Asia pacific (Singapure). </li></ul></ul>
  6. 7. Availability Zone
  7. 8. EC2 Instance Families <ul><li>Standard – Small, Large, Extra Large. </li></ul><ul><li>Micro. </li></ul><ul><li>High-CPU – Medium, Extra Large. </li></ul><ul><li>High-Memory – Extra Large, Double Extra Large, Quadruple Extra Large. </li></ul><ul><li>Cluster Compute. </li></ul><ul><li>Cluster GPU. </li></ul>
  8. 9. Amazon EC2 Instance Types <ul><li>Small – 1.7 GB memory, 160 GB storage. </li></ul><ul><li>Large – 7.5 GB memory, 850 GB storage. </li></ul><ul><li>Extra Large – 15 GB memory, 1690 GB storage. </li></ul><ul><li>Micro – 613 MB memory. </li></ul><ul><li>High-CPU Medium – 1.7 GB memory, 5 EC2 unit, 350 GB storage. </li></ul><ul><li>High-CPU Extra Large – 7 GB memory, 20 EC2 unit, 1690 GB storage. </li></ul>
  9. 10. Amazon EC2 Instance Types <ul><li>High-Memory Extra Large – 17.1 GB memory, 480 GB instance. </li></ul><ul><li>High-Memory Double Extra Large – 34. GB. </li></ul><ul><li>High-Memory Quadruple Extra Large – 68.4. </li></ul><ul><li>Cluster Compute – 23 GB memory, 33.5 EC2 unit, 1690 GB storage. </li></ul><ul><li>Cluster GPU </li></ul>
  10. 11. Amazon EC2 Free Tier <ul><li>Calculate each month usage for a year. </li></ul><ul><li>750 hours usage of micro instance and load balancing. </li></ul><ul><li>10 GB of Amazon Elastic Block Storage. </li></ul><ul><li>15 GB bandwidth. </li></ul>
  11. 12. Getting Started with CLI <ul><li>Setting the Java Home variable. </li></ul><ul><li>export JAVA_HOME=<PATH>. </li></ul><ul><li>Download .zip file from Amazon EC2 resource center. </li></ul><ul><li>export EC2_HOME=<path-to-tools> </li></ul><ul><li>export PATH=$PATH:$EC2_HOME/bin </li></ul>
  12. 13. X.509 certificate <ul><li>Create X.509 certificate. </li></ul><ul><li>Create a directory named .ec2 in the home dir. </li></ul><ul><li>Download the PEM-encoded certificate and private key file. </li></ul>
  13. 14. Import SSH Key Pair <ul><li>Either by OpenSSH or AWS mgmt console. </li></ul><ul><li>ec2-import-keypair phpXpert-keypair --public-key-file mykey.ppk. </li></ul><ul><li>https://ec2.amazonaws.com/?Action=ImportKeyPair &KeyName=phpXpert-keypair &PublicKeyMaterial=base64_encode(public_key). </li></ul>
  14. 15. Generate SSH key with AWS <ul><li>Create with Amazon mgmt console. </li></ul><ul><li>“ ec2-add-keypair phpXperts-keypair&quot; returns the private key. </li></ul><ul><li>Save the private key in a file like “id_rsa-phpXpert-keypair” and set file permission. </li></ul><ul><li>https://ec2.amazonaws.com/ ?Action=CreateKeyPair &KeyName=gsg-keypair &...auth parameters… </li></ul>
  15. 16. Tell Who You Are? <ul><li>$export EC2_PRIVATE_KEY=~/.ec2/pk-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem </li></ul><ul><li>$export EC2_CERT=~/.ec2/cert-HKZYKTAIG2ECMXYIBH3HXV4ZBZQ55CLO.pem </li></ul><ul><li>$export EC2_URL=https://<service_endpoint> </li></ul>
  16. 17. Launch Instance
  17. 18. Launch an Instance: CLI <ul><li>$ec2-run-instances ami-3ac33653 -k gsg-keypair </li></ul><ul><li>RESERVATION r-f25e6f9a 999988887777 default INSTANCE i-85b435ee ami-3ac33653 pending gsg-keypair 0 m1.small 2010-03-30T08:01:36+0000 monitoring-disabled ebs us-east-1a aki-407d9529 </li></ul><ul><li>$ec2-describe-instances i-85b435ee RESERVATION r-f25e6f9a 999988887777 default INSTANCE i-85b435ee ami-3ac33653 ec2-67-202-28-13.compute-1.amazonaws.com domU-12-31-39-00-78-93.compute-1.internal running gsg-keypair 0 m1.small 2010- 03-30T08:01:36+0000 us-east-1a aki-407d9529 monitoring-disabled 67.202.28.13 10.254.127.97 ebs BLOCKDEVICE /dev/sda1 vol-02a2a46b 2010-03-30T08:01:44.000Z </li></ul>
  18. 19. Launch an Instance: API <ul><li>https://ec2.amazonaws.com/ ?Action=RunInstances &ImageId=ami-3ac33653 &MaxCount=1 &MinCount=1 &KeyName=gsg-keypair &Placement.AvailabilityZone=us-east-1a </li></ul><ul><li>https://ec2.amazonaws.com/ ?Action=DescribeInstances &InstanceId=i-2ba64342 </li></ul>
  19. 20. Choose AMI
  20. 21. Community AMI <ul><li>Alestic.com </li></ul>
  21. 22. Start/Stop Instances: API <ul><li>https://ec2.amazonaws.com/ ?Action=StopInstances &InstanceId.1=i-10a64379 &...auth parameters... </li></ul><ul><li>https://ec2.amazonaws.com/ ?Action=StartInstances &InstanceId.1=i-10a64379 &...auth parameters... </li></ul>
  22. 23. Choosing Instance Types
  23. 24. Create a Key Pair
  24. 25. Create a Key Pair
  25. 26. Choose Security Group
  26. 27. Amazon EC2 Console
  27. 28. Public DNS
  28. 29. Connect to Instance <ul><li>ec2-get-console-output instance_id </li></ul><ul><li>ssh -i id_rsa-gsg-keypair root@ec2-67-202-51-223.compute-1.amazonaws.com </li></ul>
  29. 30. What about Security?
  30. 31. Security Groups
  31. 32. Security Group:CLI <ul><li>$ec2-authorize default -p 22 -s your-local-system's-public-ip-ad dress/32 PERMISSION default ALLOWS tcp 22 22 FROM CIDR your- local-system's-public-ip-address/32 </li></ul><ul><li>$ec2-authorize default -p 3389 -s your-local-system's-public-ip-ad dress/32 PERMISSION default ALLOWS tcp 3389 3389 FROM CIDR your-local-system's-public-ip-address/32 </li></ul><ul><li>$ec2-authorize default -p 80 PERMISSION default ALLOWS tcp 80 80 FROM CIDR 0.0.0.0/0 </li></ul>
  32. 33. Security Group: API <ul><li>https://ec2.amazonaws.com/ ?Action=AuthorizeSecurityGroupIngress &GroupName=default &IpProtocol=tcp &FromPort=22 &ToPort=22 &CidrIp=your-local-system's-public-ip-address/32 </li></ul><ul><li>https://ec2.amazonaws.com/ ?Action=AuthorizeSecurityGroupIngress &GroupName=default &IpProtocol=tcp &FromPort=3389 &ToPort=3389 &CidrIp=your-local-system's-public-ip-address/32 </li></ul><ul><li>https://ec2.amazonaws.com/ ?Action=AuthorizeSecurityGroupIngress &GroupName=default &IpProtocol=tcp &FromPort=80 &ToPort=80 &CidrIp=0.0.0.0/0 </li></ul>
  33. 34. What is Elastic IP? <ul><li>Static IP address. </li></ul><ul><li>Associated with your account, not instances. </li></ul><ul><li>It propagate instantly throughout the web. </li></ul>
  34. 35. Elastic IP
  35. 36. Elastic IP
  36. 37. Terminate Instances
  37. 38. Start/Stop Instances with CLI <ul><li>ec2-stop-instances i-10a64379 </li></ul><ul><li>IMAGE i-10a64379 running stopping </li></ul><ul><li>ec2-start-instances i-10a64379 </li></ul><ul><li>IMAGE i-10a64379 stopped pending </li></ul>
  38. 39. Tools <ul><li>Elasticfox – Firefox addons. </li></ul><ul><li>AWS toolkit for Eclipse. </li></ul>
  39. 40. Questions?

×