Advertisement
Javi

AWS: EC2 introduction

Apr 4th, 2018
623
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.61 KB | None | 0 0
  1. # Introducción a EC2
  2.  
  3. * Presentación: twitter de javi, web de capside, web de aws
  4.  
  5. * Aplicación a desplegar: https://thelounge.chat/
  6.  
  7. * Diagrama: red, vm con software, ip flotante, firewall 8080
  8.  
  9. * Login en AWS console
  10.  
  11. * Seleccionar región
  12.  
  13. * Presentar default vpc
  14.  
  15. * Presentar el IAM
  16. * Crear policy EIPAdmin
  17. ```
  18. {
  19. "Version": "2012-10-17",
  20. "Statement": [{
  21. "Action": [
  22. "ec2:AllocateAddress",
  23. "ec2:AssociateAddress",
  24. "ec2:DescribeAddresses",
  25. "ec2:DisassociateAddress"
  26. ],
  27. "Resource": [
  28. "*"
  29. ],
  30. "Effect": "Allow"
  31. }]
  32. }
  33. ```
  34.  
  35. * Crear role lounge-chat-instance con la nueva policy EIPAdmin
  36.  
  37.  
  38. * Presentar EC2
  39.  
  40. * Presentar elastic IP
  41. * Crear EIP lounge-server
  42.  
  43. * Generar key: ssh-keygen -t rsa
  44. * Subir public
  45.  
  46. * amazon linux, t2.micro, IAM role, auto-assign public ip + user-data, 8gb ssd, Name, Owner, Project, loung-chat-server-sg (22, 8080), launch (keypair)
  47.  
  48. ```
  49. #!/bin/sh
  50.  
  51. curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.8/install.sh | bash
  52. export NVM_DIR="$HOME/.nvm"
  53. [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
  54. [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
  55. nvm install --lts
  56. npm -g install thelounge
  57.  
  58. IP=<YOUR-VERY-OWN-ELASTIC-IP>
  59. INSTANCE=$(curl http://169.254.169.254/latest/meta-data/instance-id)
  60. aws ec2 associate-address --instance-id $INSTANCE --public-ip $IP --region eu-west-1
  61.  
  62. lounge start --host 0.0.0.0 --port 8080 --public
  63. ```
  64.  
  65. * Presentar IP/DNS en detalles
  66. * Revisar log de arranque (settings)
  67. * Acceder al chat
  68. * Proponer paso a HA con ASG
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement