AWS Serverless

  • Allows you to run your application code in the cloud without having to worry about managing any servers.
  • AWS handles the infrastructure management task so that you can focus on writing code.
  • AWS takes care of following tasks
    • Capacity provisioning
    • Patching
    • Autoscaling
    • High availability
  • Advantages
    • Speed to market
      • By eliminating the overhead of managing servers you can release code quickly and get your application to market faster.
    • Super scalable
      • You can have 1 million users on your website and every thing will scale automatically.
    • Lower costs
      • You never pay for over provisioning. Server less applications are event driven and you are only charged when your code is executed.
    • Focus on your application
      • AWS offers a range of server-less technologies which integrate seamlessly. Allowing you to focus on building great applications.
  • Server less technologies
    • Lambda
      • Enable you to run code as a function without provisioning any servers.
    • Simple Queue Service(SQS)
      • A messaging queue service that allows you to decouple and scale your applications.
    • Simple notification service(SNS)
      • A messaging service for sending text, messages, mobile notifications, and emails.
    • API gateway
      • Allows you to create publish and secure API’s at any scale.
    • Dynamo, DB
      • Fully managed, no SQL database.
    • S3
      • Object, storage and web hosting
  • Uses
    • Enables you to build scalable applications quickly without managing any servers.
    • Low-cost as server, less applications are event driven and you are only charged when your code is executed.
    • AWS handles the heavy lifting that is you can focus on writing code and building your application instead of configuring servers.
  • Building server-less website
    • Architecture of our website will be as follows.
      • Lambda
        • Run python code.
      • API gateway
        • A trigger to invoke our lambda function.
      • S3
        • Host the website
    • Create lambda function
      • Give it a name
      • Select runtime
      • Select execution role
      • Select create function
      • Add python code to code source
        • The code interpreter is from cloud nine IDE, which was acquired by AWS.
      • Hit deploy
      • Add trigger
        • Select API gateway
        • Create new API
        • API type as HTTP API
        • Select security
        • Give API name
        • Deployment stage
        • Enable Cross origin resource sharing
        • Click add
        • We see our Gateway configured And it has a URL
    • Create S3 bucket.
      • Give bucket a name
      • Object ownership enable ACL
      • Disable block, public access, settings of the bucket.
      • Select create bucket
      • Select your bucket and enable “static website, hosting” setting
        • Select index document file
        • Select error document file
      • Upload the index.html and error.html files
        • Make sure you are calling API gateway url in index.html using XML HTTP request.
        • Select permission of public read access on Files.
      • Go to properties of S3 bucket, and scroll down to website hosting.
        • You will find your Static website hosting Endpoint for your server-less website.
    • Go to end point from your browser and you will see your website.
  • Characteristics of event driven architecture
    • Event driven architecture
      • Asynchronous
        • Events and asynchronous communication used to loosely couple application components. An event or Message might trigger an action, but no response is expected or required.
    • Loosely coupled
      • Services and components operate and scale independently of each other.
    • Single purpose functions
      • Stateless functions performing a short-lived task.
    • AWS services used as building blocks for applications.
    • Minimal maintenance
      • Many, AWS services, provide inherent scalability, performance, and reliability
    • Best practice
      • Avoid writing extra code to do some thing that AWS already offers as a service.
    • Components that make up an event driven architecture.
      • Event source - S3, Dynamo DB
      • Event destination - SNS, lambda
      • Event router - Event Bridge
  • Examples
    • Banking system architecture
      • Customer request hits API gateway.
      • API gateway hits step function with required inputs for fixed deposit creation.
      • Each step in a step function triggers, a lambda, depending on conditions.
      • The Lambda then writes an update in Dynamo DB.
      • The table update triggers an event in event bridge which may send desired notifications in customer queue.
    • Image processing example architecture
      • Uploaded images creates a trigger two image processing lambda.
      • The Lambda Function performs processing on the uploaded image, and resizes as a thumbnail.
      • After processing the image, the Lambda stores, metadata in our Dynamo, DB and processed image in S3.
    • Processing streaming data
      • Social media events Triggers kineses fire hose.
      • lambda function consumes data from kineses and performs processing on it and saves results in Dynamo DB table.

Comments

Popular posts from this blog

Effect : Deny vs No Action

AWS Summaries

Infrastructure Setup using Cloud Formation Templates