Posts

Showing posts from July, 2023

AWS - API Gateway

Image
This post will show how to integrate lambda function with API Gateway. From the AWS UI -> API Gateway -> REST API. We will proceed to add a POST Method. POST means we will send a payload and get response. Enter the lambda function which we created in the previous post. This will prompt to create role in lambda. The next page takes to. Next, we will proceed with creating a Deploy API. This will create an "Invoke URL". Now, let's try with the invoke URL from the local code. And it worked.

AWS - Lambda Function

Image
  This is a two-part series. In this first post, we will see how to create a lambda function and the type of lambda function. Steps to create lambda function on AWS UI. One of the prerequisites is to create a role that as Lambda execution permission. Now we have a role created. Let's proceed with the function creation. Let's test the code by creating an event. Lambda function can be invoked ASYNC or SYNC. From UI, ASYNC is the default setting. Executing the lambda via SYCN/ASYCN can be triggered via CLI. SYNC: When a lambda is invoked via SYNC it sends the response to the calling function once the lambda execution is completed. ASYNC: When a lambda is invoked via ASYNC it sends an empty response with response code 202. As ASYNC places the lambda into an event queue and executes ASYNC-ly. > aws lambda invoke --function-name <lambda-name> --invocation-type RequestResponse/Event  --cli-binary-format raw-in-base64-out --payload <JSON> response.json - -invocation-typ...

AWS - S3 - CORS

Image
  CORS is a feature of HTTP that uses headers to allow browsers to display content that a web server requested from a different origin.  To allow your content to appear, configure a CORS policy on your Amazon S3 bucket.  Proper  configuration of the CORS policy  makes sure that the appropriate headers are returned. You can configure a CORS rule on your bucket using the Amazon S3 console or AWS CLI. Cross-origin resource sharing (CORS) defines a way for client web applications that are loaded in one domain to interact with resources in a different domain.  To configure your bucket to allow cross-origin requests, you add a CORS configuration to the bucket.  A CORS configuration is a document that defines rules that identify the origins that you will allow to access your bucket, the operations (HTTP methods) supported for each origin, and other operation-specific information. I am starting with creating an S3 bucket and setting up a sta...

AWS - S3 Lifecycle

Image
  An S3 Lifecycle configuration is a set of rules that define actions that Amazon S3 applies to a group of objects. There are two types of actions: To manage your objects so that they are stored cost-effectively throughout their lifecycle, configure their  Amazon S3 Lifecycle.  There are two types of actions: Transition actions – These actions define when objects transition to another storage class. For example, you might choose to transition objects to the S3 Standard-IA storage class 30 days after creating them, or archive objects to the S3 Glacier Flexible Retrieval storage class one year after creating them.  Expiration actions – These actions define when objects expire. Amazon S3 deletes expired objects on your behalf. Lifecycle expiration costs depend on when you choose to expire objects .     When an object reaches the end of its lifetime based on its lifecycle configuration, Amazon S3 takes an action based on which state the buck...