AWS Classroom Series – 25/Feb/2021

Microservices – do onething and do it well

  • Microservices focus more on decoupling an application, and the communication mechanism is lightweight and typically http.
  • Large complex applications can be broken down into components with bounded context to build a generic service. Preview
  • Application like ecommerce can be broken down into multiple microservices such as
    • User signup
    • Inventory
    • Order Management
    • Order Tracking Management
    • Invoice Generator
  • Docker containers and Orchestration tools like k8s are very popular over here.

Nano Services

  • Nano services helps in breaking down microservcies into operations. Preview
  • This is where the serverless technologies like AWS Lambda/Azure functions can be very handy.

Prereq’s for AWS Lambda

AWS Lambda Basics

  • Function:
    • this is piece of your own code that executes every time it is triggered by an event.
    • This function can be written in different programming languages. Refer Here for the specific versions of the runtimes
      • Node js
      • Python
      • Ruby
      • Java
      • Go
      • C#
      • Powershell

Anatomy of Lambda function

  • Handler function: This is entry point for all Lambda functions. Whenever the function executes, the service calls the handler function and passes in some event data and useful objects
  • Node Js
exports.handler = function(event, context, callback) {
    callback(null, 'executed succesfully')
}
  • Python
def handler(event, context):
    return "executed successfully"
  • C#:
public string Handler(string input, ILambdaContext context) {
    return "executed successfully";
}
  • Java:
public String handler(InputStream inputStream, OutputStream outputStream, Context context) {
    return "executed Successfully";
}
  • Context object in python has the following structure Refer Here

Lets install Boto3

Java AWS SDK

Next Steps:

  • We will write aws lambda function to shutdown all the ec2 instances

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Please turn AdBlock off
Social Network Widget by Acurax Small Business Website Designers

Discover more from Direct DevOps from Quality Thought

Subscribe now to keep reading and get access to the full archive.

Continue reading

Visit Us On FacebookVisit Us On LinkedinVisit Us On Youtube