Programming Amazon Web Services

3,081 views

Published on

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,081
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
53
Comments
0
Likes
4
Embeds 0
No embeds

No notes for slide

Programming Amazon Web Services

  1. 1. PROGRAMMING AMAZON WEB SERVICES Danilo Poccia | Solutions Architect
  2. 2. “PROGRAMMING” DIFFERENT MEANINGS IN DIFFERENT TIMES
  3. 3. AT THE BEGINNING (FOR ME) WAS THIS
  4. 4. THERE WERE NO “APPS” SO I HAD TO WRITE SOMETHING
  5. 5. CROSSING MY FINGERS INSTALLING MY FIRST LINUX
  6. 6. EVERYTHING CHANGED WITH WWW
  7. 7. http://petelepage.com/blog/2011/11/html5-guy-gelaskin/
  8. 8. A RICH CLIENT EXPERIENCE IN MY BROWSER CAN HTTP BE THE LIMIT?
  9. 9. WEBSOCKETS
  10. 10. WEBSOCKETS FULL-DUPLEX
  11. 11. WEBSOCKETS FULL-DUPLEX (NO POLLING)
  12. 12. WEBSOCKETS HANDSHAKE
  13. 13. WEBSOCKETS HANDSHAKE GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Origin: http://example.com Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 13
  14. 14. WEBSOCKETS HANDSHAKE GET /chat HTTP/1.1 Host: server.example.com Upgrade: websocket Connection: Upgrade Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ== Origin: http://example.com Sec-WebSocket-Protocol: chat, superchat Sec-WebSocket-Version: 13 HTTP/1.1 101 Switching Protocols Upgrade: websocket Connection: Upgrade Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo= Sec-WebSocket-Protocol: chat
  15. 15. • server.js • package.json • Player.js • public/ • index.html • style/ • reset.css • game.css • js/ • requestAnimationFrame.js • Input.js • game.js • Player.js SERVER CLIENT
  16. 16. • server.js • package.json • Player.js • public/ • index.html • style/ • reset.css • game.css • js/ • requestAnimationFrame.js • Input.js • game.js • Player.js SINGLE APP Node.js + Socket.IO
  17. 17. “HOW DO I DEPLOY MY APP ?”
  18. 18. You need to deal with infrastructure
  19. 19. ON-DEMAND PAY AS YOU GO ELASTIC
  20. 20. On a global footprint Region US-WEST (N. California) EU-WEST (Ireland) ASIA PAC (Tokyo) ASIA PAC (Singapore) US-WEST (Oregon) SOUTH AMERICA (Sao Paulo) US-EAST (Virginia) GOV CLOUD ASIA PAC (Sydney)
  21. 21. ELASTIC BEANSTALK QUICKLY DEPLOY AND MANAGE APPLICATIONS
  22. 22. CHOOSE YOUR CONTAINER
  23. 23. DEPLOY YOUR APPLICATION
  24. 24. User Application Application Service HTTP Service Language Interpreter Operating System Host THE CONTAINER IS CREATED IN EC2
  25. 25. ELASTIC BEANSTALK TAKES CARE OF THE ENVIRONMENT
  26. 26. ADDING ELASTIC LOAD BALANCER
  27. 27. CONFIGURING AUTO SCALING GROUP
  28. 28. LAUNCHING INSTANCE(S)
  29. 29. ALL WIRED WITH ELASTIC BEANSTALK
  30. 30. APPLICATION IS PUBLISHED UNDER A CNAME
  31. 31. WITH LOGS AND APP VERSIONS STORED IN S3
  32. 32. HOW DO YOU CREATE AN APPLICATION FOR ELASTIC BEANSTALK ?
  33. 33. LIKE ANY OTHER APPLICATION
  34. 34. Source uploaded and executed in AWS Source downloaded and executed locally NO DEPENDENCIES ON AWS FOR BEANSTALK DEPLOYMENT
  35. 35. Java .war file Microsoft Web Deploy package PHP .zip file Python .zip file Git integrationIDE plugins PACKAGE UP AS NORMAL
  36. 36. CONSOLE DEPLOYMENTS AND VERSION UPDATES
  37. 37. CheckDNSAvailability elastic-beanstalk-check-dns-availability CreateApplication elastic-beanstalk-create-application CreateApplicationVersion elastic-beanstalk-create-application-version CreateEnvironment elastic-beanstalk-create-environment eb init wizard to initialize an application eb start/stop start/stop an application eb update update application version eb status get status of a running application COMMAND LINE TOOLS AND “WIZARDS”
  38. 38. ECLIPSE INTEGRATION
  39. 39. VISUAL STUDIO INTEGRATION
  40. 40. GIT INTEGRATION
  41. 41. CONTAINER CONFIGURATION
  42. 42. “Elastic Beanstalk ci ha permesso di sfruttare la potenza dell’Auto Scaling di EC2 senza alcuna fatica. La procedura di deploy integrata con git è veramente comoda e veloce.” FunGo Studios www.fungostudios.com
  43. 43. AWS Elastic Beanstalk AWS OpsWorks AWS CloudFormation Amazon EC2
  44. 44. AWS Elastic Beanstalk AWS OpsWorks AWS CloudFormation Amazon EC2 CONVENIENCE CONTROL
  45. 45. AWS Elastic Beanstalk AWS OpsWorks AWS CloudFormation Amazon EC2 CONVENIENCE CONTROL HIGH-LEVEL DO IT YOURSELF
  46. 46. THERE IS NO ADDITIONAL CHARGE FOR USING ELASTIC BEANSTALK OPSWORKS CLOUDFORMATION
  47. 47. YOU PAY ONLY FOR THE AWS RESOURCES NEEDED TO STORE AND RUN YOUR APPLICATIONS
  48. 48. = PROGRAMMABLE PLATFORM
  49. 49. API | SDK | CLI
  50. 50. API | SDK | CLI
  51. 51. “Amazon DynamoDB initially served as a secondary data store for user activity and interaction logs. However, this new NoSQL database service was integrated into the production environment as the primary data store when Shazam realized it could support over 500,000 writes per second. The company is also using Amazon EMR for large-scale data analysis that can require more than 1 million writes per second.”
  52. 52. “All files stored online by Dropbox are encrypted and kept securely on Amazon’s Simple Storage Service (S3) in multiple data centers located across the United States.”
  53. 53. Object Storage Send Email Message Queue Notification (Pub & Sub) NoSQL DB Video Transcoding Content Delivery Monitoring WHAT DO I NEED TO ?DO
  54. 54. S3 SES SQS SNS DynamoDB Elastic Transcoder CloudFront CloudWatch Object Storage Send Email Message Queue Notification (Pub & Sub) NoSQL DB Video Transcoding Content Delivery Monitoring WHAT DO I NEED TO ?
  55. 55. AWS is a set of building blocks
  56. 56. « Improving daily work is even more important than doing daily work. » Gene Kim, Kevin Behr, George Spafford, The Phoenix Project: A Novel About IT, DevOps, and Helping Your Business Win
  57. 57. var AWS = require('aws-sdk'); sqs = new AWS.SQS();
  58. 58. sqs.client.getQueueUrl( { QueueName: 'JustAGame-Queue’ }, function(err, data) { if (!err) { console.log("Get Queue URL: "+data.QueueUrl); queueUrl = data.QueueUrl; } else { console.log("Error getting Queue URL: "+err); } } );
  59. 59. sqs.client.sendMessage( { QueueUrl: queueUrl, MessageBody: 'onNewPlayer id: '+this.id }, function(err, data) { if (!err) { console.log("Message sent, id: "+data.MessageId); } else { console.log("Error sending message: "+err); } } );
  60. 60. SCALABILITY
  61. 61. SESSION DATA SCALABILITY OTHER DATA
  62. 62. SESSION DATA SCALABILITY OTHER DATA DynamoDB Redis Memcached/ElastiCache … DynamoDB MySQL/RDS Redis …
  63. 63. TIME FOR A DEMO
  64. 64. A prototype shouldn't require big investments…
  65. 65. …it should be cheap and validate ideas
  66. 66. Problem: Needed to reduce IT costs and were looking to create a more flexible IT environment Solution: AWS’s low, pay-as-you-go prices and reliable services. With every request, the application authenticates devices, delivers apps and content, and pushes notifications. Business Benefits: Saved $34M in hardware and maintenance expenses, 85% less than running on- premises Samsung saved $34M on their Smart Hub application
  67. 67. INNOVATE
  68. 68. « Want to increase innovation? Lower the cost of failure » Joi Ito
  69. 69. http://aws.amazon.com/free

×