$30 off During Our Annual Pro Sale. View Details »

AWS small talk

AWS small talk

simple talking of how we use amazon aws services for our rails application

Jimmy Huang

December 01, 2016
Tweet

More Decks by Jimmy Huang

Other Decks in Programming

Transcript

  1. AWS Small Talk

    View Slide

  2. View Slide

  3. Amazon Services
    EC2
    S3
    SES
    Cloudfront

    View Slide

  4. EC2
    Amazon Elastic Compute Cloud (Amazon EC2) is a
    web service that provides resizable compute capacity
    in the cloud. It is designed to make web-scale cloud
    computing easier for developers.
    Virtual Servers, scalable computing capacity

    View Slide

  5. View Slide

  6. View Slide

  7. EBS
    Amazon Elastic Block Store (Amazon EBS) provides persistent
    block storage volumes for use with Amazon EC2 instances in
    the AWS Cloud. Each Amazon EBS volume is automatically
    replicated within its Availability Zone to protect you from
    component failure, offering high availability and durability.
    EBS is mountable storage; it can be mounted as a device to an
    EC2 instance. Multiple EBS “drives” can be mounted to one
    EC2 instance, and they can be then striped and/or mirrored into
    a larger volume using software RAID
    Hard driver

    View Slide

  8. Install the command tools, database, web server etc to
    launch your Rails app

    View Slide

  9. EC2 for Arcane
    3 instances
    Host in eu-west (Ireland)
    Benchmark by sysbench (CPU, IO)
    Web performance bench by apache & ab

    View Slide

  10. Price

    View Slide

  11. What the f**k ?

    View Slide

  12. S3
    Amazon S3 (Simple Storage Service) is an web service
    offered by Amazon Web Services. Amazon S3 provides
    storage through web services interfaces (REST, SOAP,
    and BitTorrent).
    Public folder on cloud

    View Slide

  13. View Slide

  14. https://s3-eu-west-1.amazonaws.com/arcane-production/uploads/user/logo/10/%E9%98%BF%E8%BF%AA%E5%B0%8F%E5%B8%BD1.jpg

    View Slide

  15. View Slide

  16. View Slide

  17. S3 & Rails
    gem ‘carrierwave’
    gem ‘carrierwave-aws’
    gem ‘fog’ (gem ‘fog-aws’)

    View Slide

  18. View Slide

  19. View Slide

  20. View Slide

  21. CloudFront
    Amazon CloudFront is a content delivery network
    (CDN) offered by Amazon Web Services. Content
    delivery networks provide a globally-distributed
    network of proxy servers which cache content, such as
    web videos or other bulky media, more locally to
    consumers, thus improving access speed for
    downloading this content.

    View Slide

  22. View Slide

  23. /uploads/campaign/
    cloud_music/814/EXTSY%27s%20Addicted%20Radio%20%23091.mp3
    https://arcane-production.s3-eu-west-1.amazonaws.com
    https://d15k0o6rdrjcy5.cloudfront.net

    View Slide

  24. CloudFront & Rails

    View Slide

  25. SES
    Amazon Simple Email Service (Amazon SES) is a cost-
    effective email service built on the reliable and scalable
    infrastructure that Amazon.com developed to serve its
    own customer base.
    Email service, send and receive email

    View Slide

  26. View Slide

  27. View Slide

  28. SES & Rails

    View Slide

  29. Tips (ଗᨵ҂

    View Slide

  30. Host assets: CloudFront > S3 > EC2

    View Slide

  31. Don’t use S3 to save “temporary files”

    View Slide

  32. Backend Job for transferring file from EC2 -> S3
    sidekiq, resque

    View Slide

  33. Don’t use carrierwave default way to upload big file to
    cloud

    View Slide

  34. Decide the S3 bucket name as early as possible if you
    or client has compulsion

    View Slide

  35. Use s3cmd command tool to operate s3 bucket and
    files

    View Slide

  36. Use presigned url for S3 resource downloading

    View Slide

  37. Back up your database to S3 (use Backup gem)
    https://github.com/damm/backup
    backup perform -t arcane_local_backup -r /home/jimmy/Backup

    View Slide

  38. Configure your SES bounce & complaint notification

    View Slide

  39. – Jimmy @ekohe
    “Thanks, AWS”

    View Slide