Posts

Lambda functions

Image
 Lambda functions Lambda is special service in AWS makes event-driven development much more accessible and easier. Lambda allows you to execute function after some kind of event.  Let's see this in action, so that would be more easier to understand. So what I will do is, I will create a lambda function which will be triggered when someone do some operation on my S3 bucket then it will log a simple message. First need to search lambda in dashboard We have to set our runtime here, Please select any Python runtime   We will use this code block import json import logging logger = logging.getLogger() logger.setLevel(logging.INFO) def lambda_handler ( event , context ): logger.info( "Python is awesome" ) return { 'statusCode' : 200 , 'body' : 'Log entry created' }  After pasting here, click to deploy code button We have to set permissions first. As you might already know that all services in AWS are segregated in terms o...

Elastic Container Service

Image
Elastic Container Service Let's start with the question "What is container ?" and "What is serverless ?". Container : is virtualization technology unlike the technology we have talked about before like hypervisor, it sits on top of host operating system (OS) of server and runs there. It is important information to know that you can run both Linux and Windows containers on Windows host machine but vice-versa is not true. Thanks to the Moby VM Windows OS uses, you can create Linux containers in Windows. Serverless : is a thing we call when you deploy and run your application on cloud computing platform but it is fully managed but it. For example, there is a application which uses Lambda functions for, SQS, REST API, ECS, S3 bucket for all functionalities. And all those services managed by AWS. So we can call it serverless application. Mostly these applications are event-driven, auto-scaling, employes FaaS (Function as a Service) , very cost-efficient (you are bill...

Amazon CloudFront

Image
 Amazon CloudFront Amazon cloudfront is CDN (Content Delivery Network) service that allows to serve your content with little or no delay effortlessly. The content copied to the edge locations all over the world. Edge location is a site that AWS uses to cache contents to improve latency. So when user access the content he/she will receive it from the closest AZ (Availability Zone). This is how it works : We provide CloudFront origin, it can be S3 bucket files (for example: html, pdf etc.) or another origin such as web app. you run on EC2 instance or a Load Balancer. So after that CloudFront starts caching them in Regional Edge Cache and those propagated to Edge Locations as well. So by that your content becomes globally available. CloudFront reduces latency and improves performance. You can also utilize AWS Shield (DDOS protection) and WAF (web threat protection) technologies to protect your resources. Let's create simple web page and serve it over S3 bucket. And use CloudFront as C...

Amazon Route 53

Image
 Amazon Route 53 What is DNS ? DNS stands for Domain Name Service. In basic terms DNS allows you to quickly lookup the IP address of given domain. This information is located in the zone files of Domain Name server. These dedicated server's main responsibility is to provide DNS record of given domain. There are different variety records listed below, and each one of them serves different purpose.   Let's use commandline tool called "nslookup" to perform name service lookup. Amazon Route 53 - is AWS's one of main component mainly deals with DNS. Main things it can do : Domain registration. Creating public and private zone files. Health checks (If the resources are deployed across different regions, and any  resource not sending healthy response redirect users to other region or resource) There are some routing policies : Simple - Just provides simple DNS response (record) Failover - If primary destination is down then redirect to secondary. Geolocation - Direct use...

AWS Infrastructure as Code - Cloudformation

Image
 AWS Infrastructure as Code - Cloudformation In AWS cloudformation we have to know 3 important concept: Stack Template ChangeSet Let's give simple definition to these but it will be clear with hands on example. Template - is a yaml or json file we create. This file serves a purpose of containing the infrastructure of code (also known as Infrastructure as Code - IaC). This means this file provides the directions to AWS what to create and how to connect building blocks. Stack - on the other hand is collection of AWS resources, you can use a single unit. ChangeSet - allows you to see changes before applying into stack. Let's create a simple stack using template : The template below will create simple webpage using user-data and EC2, will allow connections for ports 22,80  Resources : MyEC2Instance : Type : AWS::EC2::Instance Properties : AvailabilityZone : eu-north-1a ImageId : ami-05edb7c94b324f73c InstanceType : t3.micro SecurityGroups : ...

AWS - Databases DynamoDB, RDS

Image
AWS - Databases There are 3 main database types in software world: Relational databases (MySql, Postgre, Amazon RDS etc.) Non-relational databases (Mongo, Amazon DynamoDB etc.) Graph databases (Amazon Neptune, NebulaGraph etc.) For your specific use case they have advantages and disadvantages.  We will cover relational and non-relational databases in this post.  Relational databases - as name implies stores information based on defined relation. Organized by tables, columns, rows. Supports complex queries and joins. Non-relational databases - contrary to the relational databases non-relational databases are more flexible. Documents, key/value, columns and graphs are some forms can be used to organize data. Databases in Amazon There are few ways to use database in AWS : Database on EC2 - We deploy any database software onto our instance and use it like this. Amazon RDS  - Amazon provided service, under the hood you can use (MySql,Postgre,Maria Amazon Aurora etc.) relationa...

S3 - Create a static website

Image
 S3 - Create a static website Creating static website with S3 bucket is very easy. This will make not only your website fast but also hassle-free and cheap alternative to traditional hosting. Please read this post before going further -  https://www.learn-aws.com/2024/11/s3.html  Create a bucket and set the permissions.  Click on the bucket, and navigate to the "Properties" tab, scroll down you will see this option. Edit it like below. Create a simple index.html file like the one below and upload it with the files you used in index file. In this case "aws.png" is also uploaded into the bucket as well. <html> <title> Hello from AWS S3 </title> <body> <img src="aws.png" alt="AWS"> </body> </html>  If we do everything right, we will be able to see rendered html when we copy and paste the link in the index file's link in S3 service.