AWS etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster
AWS etiketine sahip kayıtlar gösteriliyor. Tüm kayıtları göster

19 Mart 2026 Perşembe

Amazon Web Service (AWS) EventBridge - “Kafka-lite, fully managed, rule-based event routing

Giriş
Akış şöyle
Webhooks → simple HTTP push (external trigger mechanism)
Amazon EventBridge → event router (central nervous system)
AWS Lambda → code runner (brain doing the work)
Burada bir tane örnek mimari var. Bu mimaride Webhook çağrıları direkt mikroservislere tetikleyeceğine önce AWS EventBridge'a giriyorlar. Daha sonra buradan yönlendiriliyorlar. Bu mimarideki önemli noktalar şöyle
The Patterns Nobody Documents
Here’s what I learned building this that you won’t find in AWS documentation.

Pattern 1: Event Normalization at the Edge
Don’t let raw external events onto your bus. Ever. Your webhook handler should transform vendor-specific payloads into domain events. When we integrated PayPal, our services didn’t care. They still received payment.completed events with the same schema.

Pattern 2: Event Versioning from Day One
We screwed this up initially. Six months in, we needed to change the event schema. Half our services were still consuming v1 events. Now every event includes a version field, and EventBridge rules route based on version. Services can migrate on their own schedule.

Pattern 3: Dead Letter Queues for Everything
This saved us during Black Friday. A bug in the inventory service caused it to reject 15% of order.created events. Because we had DLQs configured, those events sat safely in a queue while we fixed the bug, then we replayed them. Zero lost orders.

Pattern 4: Archive Anything That Touches Money
EventBridge archiving is criminally underused. We archive every payment-related event for 90 days. When customers dispute charges, we have perfect audit trails. When the finance team needs transaction reports, we replay archived events. Cost? $47/month for 2.1M archived events.

7 Ocak 2025 Salı

aws ce - Cost Expolorer Seçeneği

Örnek
Şöyle yaparız
aws ce get-reservation-utilization
Açıklaması şöyle
In AWS, use Cost Explorer to view your reserved instance utilization and identify opportunities for optimization:

15 Ekim 2024 Salı

AWS Athena

Ad-hoc queries on S3 with Some - CTAS. 

Açıklaması şöyle. Burada detaylı bir örnek var
AWS Athena enabled the option to analyze the unstructured, semi-structured, and structured data stored in Amazon S3 using simple SQL queries. In addition, query results can be saved and used for further reference.
Bir başka açıklama şöyle
Amazon Athena is a query service that allows you to run standard SQL over data stored in a variety of sources and formats, mainly used with S3 (see below). Athena is based on Presto, a distributed SQL engine that was open sourced by Facebook. Athena is serverless, so there is no infrastructure to setup or manage.

4 Ekim 2024 Cuma

AWS RDS - Relational Database Service

Giriş
MySql, PostgreSQL gibi ilişkisel veri tabanı sağlar. Açıklaması şöyle
Amazon RDS is a web service that makes it easier to set up, operate, and scale a relational database in the cloud.
Açıklaması şöyle
Amazon RDS is one of the most basic AWS database services, used mainly for offloading your database management operations to a platform. Therefore, it is used for small or medium enterprises where the data volume is limited, and the functionalities required for company operations are not too complex.

Amazon RDS supports database engines such as MySQL, MariaDB, PostgreSQL, Oracle, and Microsoft SQL Server. It comes with workflows to secure your RDS instance using SSH and offers a straightforward cloud console for connecting.
Benefits
  1. Amazon RDS is the most inexpensive service, thanks to its ease of usage and lack of complexity.
  2. It is highly scalable and allows you to scale up to 32 vCPUs and 244 Gb of RAM.
  3. This service is also easy to use and pretty fast.
Desteklenen ilişkisel veri tabanları şöyle
1. Aurora
2. Postgres SQL
3. MySQL Server
4. SQL Server
5. Oracle
6. Maria DB
RDS Özellikleri
Bunlar şöyle
- Multiple Availability Zones
- Optional Read Replicas
- Automatic Instance Backups
Volumes for storage
Açıklaması şöyle
Under the hood, all these RDS databases use Amazon Elastic Block Store (EBS) volumes for storage. 
Replication - Postgres
Açıklaması şöyle
With RDS you can choose up to two replicas located in separate availability zones, providing one primary instance (writer) and the other two stand-by (reader) instances.

The communication between the primary and the stand-by instances is done synchronously to guarantee that no data is lost.

You have a specific reader endpoint that can help with the read latency, while directing the writes to the primary. If the primary is no longer fit to receive writes, a failover will take place and one of the stand-by instances will be promoted as the new primary within 35–60 seconds. During this time attempts to write are expected to fail.

By choosing this approach,you can achieve the redundancy needed, with expected uptimes of 99.95%.

Scaling RDS
Bunlar şöyle
- Scale Manually 
- Scale Automatically
Performance Insights
AWS RDS tarafından sağlanır, en fazla performans kullanan 10 tane SQL cümlesini gösterir.

Örnek - PostgreSQL
IP adresi "Publicly accessible" true olmalı. Inbound rule çalışmıyor. Silip tekrar yaratmak gerekebilir. Bir video burada

Örnek - MySQL
Şeklen şöyle. IP adresi "Publicly accessible" true olmalı. 

2 Ocak 2024 Salı

AWS Redshift - OLAP Datawarehouse İçindir

Giriş
Açıklaması şöyle. Yani AWS Aurora'dan daha gelişmiş.
Like Amazon Aurora, Amazon Redshift is used by large enterprises. However, Redshift is more complex, can handle more data, and is referred to as a data warehouse. This is because Redshift is built for OLAP (Online Analytical Processing).

Furthermore, Redshift can scale up to Petabytes of data and supports up to 60 user-defined databases per cluster. On the other hand, Aurora can only scale to terabytes and support up to 40. Besides this, the security and the maintenance of both the database services are pretty much the same.

A few use cases of Amazon Redshift are creating machine models for forecasting operations, optimizing your company's business intelligence, and increasing developer productivity.
Benefits
  1. Redshift possesses the highest scaling capabilities amongst the three options we've examined.
  2. Its performance is much faster and more durable.
  3. Amazon Redshift can also handle a more significant amount of data and analyze it within a shorter period.
Redshift vs PostgreSQL
Açıklaması şöyle. Altta PostgreSQL 8 kullanıyor.
I mean, as much as I love AWS services, setting up Redshift as our data warehouse was a mistake and Postgres would have been a much better alternative.

Let’s be honest, unless you have massive amounts of data, more than hundreds of To’s of data, all these fancy data warehouses like Redshift just aren’t worth the cost. Redshift isn’t open source, so you can’t have a complete mini-data stack on your local computer for testing purposes. Plus, Redshift, being built on top of Postgres 8, sometimes lacks the cool features that the newer releases of Postgres have.

I know Postgres is a transactional database, but I think it’s a solid first approach for a data warehouse. If you’re dealing with tables with less than 50 million rows and under 10 terabytes of data (which is the case for most startups), Postgres might outperform Redshift. And the best part is, you can have it up and running on your local computer, making it incredibly convenient for quick iterations.

Örnek
Açıklaması şöyle
Redshift supports some SQL functions and queries which would generally only be necessary with large data warehouse applications. For example, PERCENTILE_CONT computes a linear interpolation to return a percentile.
Şöyle yaparız
SELECT
    TOP 10 salesid,
    sum(pricepaid),
    percentile_cont(0.6) WITHIN GROUP (
        ORDER BY 
            salesid
    ),
    median (salesid)
FROM
    sales
GROUP BY
    salesid,
    pricepaid;

3 Ekim 2023 Salı

Amazon Web Service EC2 Instance Çeşitleri

Hazır Tanımlanmış EC2'ler şöyle.
They are grouped into families that emphasize some possibilities for your workloads:

General Purpose (Genel Amaçlı) – also known as balanced instances, best for web servers, microservices, small and medium databases, development environments, and code repositories.

Compute Optimized (İşlem İçin Optimize Edilmiş) – designed for compute-intensive workloads, like batch processing, data analytics, scientific modeling, dedicated gaming servers, machine learning, and high-performance computing.

Memory-Optimized (Bellek İçin Optimize Edilmiş) – memory-intensive applications that process large data sets in memory, such as databases and real-time streaming.

Accelerated Computing (Hızlandırılmış Bilişim) – used for graphics processing, machine learning, data pattern matching, and other numerically intensive workloads.

Storage Optimized (Depolama İçin Optimize Edilmiş) – designed for high, sequential read and write access to very large data sets on local storage. Best for NoSQL databases, in-memory databases, data warehousing, Elasticsearch, analytics workloads.
General Purpose  - Burstable Instances
Açıklaması şöyle
In AWS, there are many Instance Families. One of them is burstable general-purpose instances, which are basically T Instance Family.

The T Instance Family offers a baseline CPU performance but it also has the ability to burst above the baseline at any time as logs as required. Which is essential for business-critical or unknown behavior of the workloads.
Burstable Olması Ne Demek
Açıklaması şöyle
Burstable Instances earn CPU credits while running below the baseline and spending them when bursting.
Bazı kavramlar şöyle
Earned Credits: The amount of credits an instance earns while running
Used Credits: When a burstable instance is in the running state, it will continuously use CPU credits. 
Accrued Credits: Difference between the earned credits and used credits is called accrued credits.
Örnek - General Purpose T2.medium
Açıklaması şöyle
For a typical, simple microservice application, a minimum configuration of t2.medium instance type should do the work. T2 instances are the lowest-cost general purpose instance type. You can easily change your instance types if after a while your needs change.

25 Ağustos 2023 Cuma

AWS Batch

Giriş
Bir örnek burada.

AWS Glue ETL vs AWS Batch
AWS Glue Apache Spark üzerinde koşuyor. Açıklaması şöyle
AWS Glue ETL is a fully managed service that provides a serverless Apache Spark environment to run your Extract, Transform, Load (ETL) jobs. 
Error Handling and Debugging
Açıklaması şöyle
AWS Glue ETL is a fully managed service  provides detailed logging for your batch jobs using Amazon CloudWatch Logs. It also allows for the re-queueing of failed jobs, enabling them to be retried automatically. AWS Batch also provides an API operation to cancel jobs, giving you control over your batch workloads.


18 Temmuz 2023 Salı

Amazon Web Service (AWS) eksctl komutu

Giriş
EKS ile çalışmayı kolaylaştırır. Açıklaması şöyle
We need to install the eksctl command-line utility to manage the EKS cluster and the Kubernetes command-line tool kubectl.

create cluster seçeneği
Örnek
Şöyle yaparız
> eksctl create cluster \ 
--name microservices \ 
--region eu-central-1 \ 
--node-type t2.small \ 
--nodes 2
Açıklaması şöyle
It will make a cluster with two worker nodes of type “t2.small” in the region “eu-central-1” with the name “microservice.”

In the background, eksctl uses CloudFormation to create the cluster, which usually takes 10–15 minutes. 
Açıklaması şöyle
From the output, it is evident that it has created two nodes and one node group. Also, it has saved the kubectl config file in ./.kube/config. In case you already have minikube or microk8s, you have to mention the ./.kube/config file as the kubeconfig parameter in the command.

Creating an EKS cluster will take around 15 minutes. Once the cluster is ready, you can check it with the following command:

> kubectl get nodes --kubeconfig ~/.kube/config
Örnek
Şöyle yaparız
$ eksctl create cluster \
  --name my-cluster \
  --version 1.18 \
  --region us-west-2 \
  --nodegroup-name my-nodes \
  --node-type t3.medium \
  --nodes 3
Örnek
Şöyle yaparız
$ eksctl create cluster \
 --name Democluster\
 --version <1.21> \
 --without-nodegroup
get cluster seçeneği
Örnek
Şöyle yaparız
$ eksctl get cluster


5 Temmuz 2023 Çarşamba

AWS Systems Manager

Giriş
Açıklaması şöyle
With Systems Manager, users exchange their AWS credentials for temporary shell access ....
EC2 instance'ları için AWS Resource Groups içinde tag yaratarak AWS Systems Manager ile hepsine shell komutunu çalıştıran bir örnek burada

AWS Systems Manager Parameter Store
Parameter Store ayarlarına sol taraftaki menüden erişilir. Açıklaması şöyle
AWS Systems Manager Parameter Store provides secure storage and management of secrets. It allows storing of data such as passwords, database strings, Amazon Elastic Compute Cloud (Amazon EC2) instance IDs and Amazon Machine Image (AMI) IDs, and license codes as parameter values. It can store values as plain text or encrypted data.
AWS Systems Manager Parameter Store vs AWS Secrets Manager
AWS Secrets Manager daha fazla özellik sağlıyor. Örneğin secret rotation gibi.

4 Temmuz 2023 Salı

AWS Transcribe

Giriş
Açıklaması şöyle
Amazon Transcribe is a service that utilizes Machine Learning models to convert speech to text automatically. It offers various features that can enhance the accuracy of the transcribed text, such as language customization, content filtering, multi-channel audio analysis, and individual speaker speech partitioning. Amazon Transcribe can be used as a standalone transcription service or to add speech-to-text capabilities to any application. You can transcribe media in real-time (streaming) or you can transcribe media files located in an Amazon S3 bucket (batch).

19 Haziran 2023 Pazartesi

aws sso seçeneği

login seçeneği
Örnek
Şöyle yaparız. Tarayıcıyı başlatır ve  AWS SSO login sayfasında yönlendirir. Burada kullanıcı adı ve şifreyi gireriz.
$ aws sso login 
Tüm çıktı şöyle
> aws s3 ls --profile poweruser

The SSO session associated with this profile has expired or is otherwise invalid. 
To refresh this SSO session run aws sso login with the corresponding profile.

> aws sso login --profile poweruser
Attempting to automatically open the SSO authorization page in your default browser.
If the browser does not open or you wish to use a different device to authorize this
request, open the following URL:

https://device.sso.us-east-1.amazonaws.com/

Then enter the code:

ABCD-EFGH
Successfully logged into Start URL: https://fooo.awsapps.com/start

> aws s3 ls --profile poweruser
...

23 Mayıs 2023 Salı

Amazon Web Service (AWS) MSK - Managed Streaming for Apache Kafka

Giriş
Açıklaması şöyle
Amazon MSK, standing for Amazon Managed Streaming for Apache Kafka, is a fully managed service that makes it easy to build and run applications that use Apache Kafka to process streaming data. However, connecting to MSK from outside of your Virtual Private Cloud (VPC) requires exposing your brokers to the Kafka clients, which may reside in another AWS account.

There are several approaches to achieve it as mentioned in the AWS article Secure connectivity patterns to access Amazon MSK across AWS Regions,

a

4 Nisan 2023 Salı

Amazon Web Service (AWS) DynamoDB - Hem Key-value Hem de Document-Oriented Çalışabilir

Giriş
Bir NoSQL veri tabanıdır, ancak multi-model'i destekler yani key-value system ve document store olarak kullanılabilir.
1. Key-value store olarak Cassandra, HBase, Redis ile rakip
2. Document DB olarak MongoDB ile rakip.


DynamoDB ilk olarak 2012 yılında piyasaya çıktı

Özellikleri şöyle

Açıklaması şöyle
DynamoDB is Amazon's answer to MongoDB, a NoSQL database that works on JSON documents. These databases rely heavily on nested data and do not enforce any strict schema unless the developer turns that option on. That means that DynamoDB is great for high-volume sites like a CMS or mobile apps with a lot of traffic. For example, both Major League Baseball and Duolingo make use of DynamoDB.
Pricing Model
1. throughput model : Kullanım miktarı tahmin edilir ve bu aşılamaz.
2. on-demand pricing model : Kullanım miktarına göre fiyatlandırılır

Yanlış Kullanım
1. Normalizing Data
DynamoDB bir SQL veri tabanı değildir. Bu yüzden denormalized şekilde kullanılmalıdır

2. Single Table Design
Single Table Design (STD) için açıklaması şöyle
In DynamoDB, you are charged for the capacity throughput and indexes of each table.

The more tables you have the more you will end up paying (especially if each table has several secondary indexes).

The STD instead encourages grouping all of your (related) data entities in one table.
Replication
Açıklaması şöyle
Departing from the traditional SQL-based offerings, DynamoDB offers a persistence model where the information is spread into partitions with a dual consistency approach.

A write operation first saves the updated data to a persistence node. It is then synchronously copied to another persistence node. Only at this point, the operation is confirmed to the caller.

There is an asynchronous process that copies it from the second persistence node to a third one.

This means you have the redundancy of the data being persisted into 3 nodes, each located in a separate AZ. At the same time, you do not need to wait for all 3 nodes to save before returning the operation, which helps to maintain the latency at a lower level.

When retrieving data you have two choices: eventually consistent and strongly consistent.

If you opt for eventually consistent, your operation will be directed to any of the 3 nodes. If it happens to be the asynchronously copied one, there is a chance the information you will retrieve will be outdated when compared to the main node.

In contrast, the strongly consistent mode will only be directed to the main node.

MongoDB vs DynamoDB 
- MongoDB en büyük belge büyüklüğü olarak 16 MB'yi destekler. Bu DynamoDB'de 400 KB
- MongoDB C++ ile geliştirilmiştir. DynamoDB Java ile geliştirilmiştir

Primary Key 
Açıklaması şöyle
... it only allows three data types for primary keys: string, number, and binary. (It does support many different data types for other attributes within a table.)
Açıklaması şöyle
DynamoDB has a weird take on the concept of a primary key. You will have two keys to identify specific data:
Primary Key = Partition Key + Sort Key
Şeklen şöyle

Örnek
Tablo şöyle olabilir
      PRIMARY_KEY     SORT_KEY         OTHER_INFO
1.    ORDER#1234       PRODUCT#1      ProductName,Price etc
2.    ORDER#1234       INVOICE#1         InvoiceDate, PaymentInfo
3.    ORDER#1234       CUSTOMER#1   CustomerName, ShippingAddress
Value Type
Açıklaması şöyle
Dynamo DB stores the value in a JSON serialized format

Sütun Tipleri
Açıklaması şöyle
DynamoDB supports many different data types for attributes within a table. They can be categorized as follows:

1. Scalar Types – A scalar type can represent exactly one value. The scalar types are numberstringbinaryBoolean, and null.

2. Document Types – A document type can represent a complex structure with nested attributes, such as you would find in a JSON document. The document types are list and map.

3. Set Types – A set type can represent multiple scalar values. The set types are string setnumber set, and binary set.

Global Secondary Index
Eğer istediğimiz veri Primary Key dışındaysa bu index kullanılır. Tek problem her indeksin tek başına bir tablo olması

DynamoDB Disadvantages
Açıklaması şöyle
Size limit — item can only reach 400KB in size
Limited querying options (limited number of indices)
Throttling on burst throughput (and hot keys in certain situations)
create-table
Örnek
Şöyle yaparız
aws dynamodb --endpoint-url=http://localhost:4566 create-table \
    --table-name Music \
    --attribute-definitions \
        AttributeName=Artist,AttributeType=S \
        AttributeName=SongTitle,AttributeType=S \
    --key-schema \
        AttributeName=Artist,KeyType=HASH \
        AttributeName=SongTitle,KeyType=RANGE \
--provisioned-throughput \
        ReadCapacityUnits=10,WriteCapacityUnits=5
describe-table
Şöyle yaparız
aws --endpoint-url=http://localhost:4566 dynamodb describe-table 
--table-name Music | grep TableStatus
put-item
Şöyle yaparız
aws --endpoint-url=http://localhost:4566 dynamodb put-item \
  --table-name Music  \
  --item \
  '{"Artist": {"S": "No One You Know"}, "SongTitle": {"S": "Call Me Today"},
"AlbumTitle": {"S": "Somewhat Famous"}, "Awards": {"N": "1"}}'
scan
Şöyle yaparız
aws dynamodb scan --endpoint-url=http://localhost:4566 --table-name Music
Örnek
Açıklaması şöyle
Because DynamoDB is not relational and does not enforce ACID by default, it must use a modified version of standard SQL. Amazon has developed a query language called PartiQL which uses many SQL concepts but is built for highly nested data. The query below takes advantage of the key-value underpinnings of DynamoDB in a relatively SQL standard way.
Şöyle yaparız
UPDATE
    Music
SET
    AwardsWon = 1
SET
    AwardDetail = { 'Grammys': [ 2020, 2018 ] }
WHERE
    Artist = 'Acme Band'
    AND SongTitle = 'PartiQL Rocks'

28 Mart 2023 Salı

AWS ElastiCache - Redis

Giriş
Açıklaması şöyle. Yani Memcached veya Redis olabilir. Memcached artık kaybolmaya başladığı için bunu Redis kabul etmek lazım
There are two types of in-memory caching engines:
1. Memcached — designed for simplicity, so used with you need the simplest model possible.
2. Redis — works for a wide range of use cases and have multi AZ. You can also complete backups/restores of redis.
Redis
Redis'in pahalı olduğu söyleniyor. ElastiCache kullanmadan önce Amazon Elastic Compute Cloud (EC2) üzerinde denenebilir. Açıklaması şöyle
Run a Docker redis in ec2 for a while first. Make sure it serves your purposes. Figure out how the sizing works for you. Remember redis is meant to hold ephemeral data in memory, so please don’t treat it as a DB. It’s best to design your system assuming that redis may or may not lose whatever is inside. Clustering or HA via Sentinel, can all come later when you know you need it!
Redis Kullanımı
İki şekilde kullanılabilir. Cluster mode enabled veya disabled olarak. Kısaca 
1 Redis-CME
2.Redis-CMD

Açıklaması şöyle
Elasticache provides two flavors of Redis, Cluster Mode Enabled (Redis-CME) and Cluster Mode Disabled(Redis-CMD). 
Redis-CMD
Açıklaması şöyle. Tek bir cluster ve tek bir shard var. Cluster'da primary ve replica düğümler var.
Broadly speaking, for Redis-CMD, there is only one shard. The shard comprises the primary node along with the read replicas. Read replicas maintain a copy of the data from the cluster’s primary node.
Redis-CME
Açıklaması şöyle. Tek bir cluster var ancal bu sefer 250 taneye kadar shard olabiliyor. Her bir shard için primary ve replica düğümler var.
For Redis-CME, Elasticache allows up to 250 shards for a Redis cluster. Each shard has a primary node and read replicas. Elasticache distributes the keyspace evenly across all the shards. When reading or writing data to the cluster, the client itself determines which shard to use based on the keyspace. This design pushes the work to the client and avoids any potential single points of failure.
Redis-CME Problemi
Açıklaması şöyle. Yani bir object graph gibi bir şeye ihtiyaç varsa, CME iyi olmayabilir
When we started using Redis, we soon realized use-cases where we wanted to fetch multiple Redis keys at once (think Friends of Friends) and to avoid multiple network round trips, we thought of using mget call in Redis which allows us to do so.
...
The caveat here was the sharded nature of our setup. This meant that essentially the keys that we were trying to fetch in one-go, could be distributed across multiple shards, i.e. across multiple nodes, defeating our fetch all-at-once requirement.
Bu problem için Redis Hashtags kullanılabilir. Açıklaması şöyle. Ancak bunu yapınca veri tüm shardlara eşit şekilde dağılmayabilir
To solve this, we started using Redis Hashtags which helped us localize all related data on a single Redis node. Redis Cluster provides the concept of hashtags, according to which, if there is a substring between {} brackets in a key, only what is inside the string is hashed. An example of this in our application would be {RELATED_STOCKS}_AAPL. By surrounding the RELATED_STOCKS section of each key in curly braces, we are effectively storing them in the same slot. This means that we can store an entire group by calling MSET once and fetch related stocks for multiple stocks at once using MGET. This usage pattern became more and more prevalent across our application. For example, all related stocks for all the stocks were now mapped to the same hash key in Redis because of {RELATED_STOCKS} hashtag, and hence same hash slot and shard on Redis, making keys distributed less evenly across nodes, which can cause certain nodes to use more memory than others.


22 Mart 2023 Çarşamba

AWS Lambda Cold Start

Giriş
Cold Start probleminin sebebi Scale To Zero

Scale To Zero
Açıklaması şöyle. Yani istek yoksa, ortam söndürülüyor, ve her şey en baştan başlıyor
What is “Scale to Zero”?
Simply put, “Scale to Zero” is a regular container deployment that automatically scales to zero instances when there is no incoming traffic. The moment a request hits the service, an instance is started to handle it. This is also commonly referred to as “cold start,” similar to e.g., AWS Lambdas.

Nearly all major cloud providers support “Scale to Zero” in some form or the other.
Cold Start Problemi
Açıklaması şöyle
When Lambda receives a request to execute a task, it starts by downloading the code from S3 buckets and creating an execution environment based on the predefined memory and its corresponding compute resources. If there is any initialization code, Lambda runs it outside the environment and then runs the handler code. The time required for downloading the code and preparing the execution environment is counted as the cold start duration. After executing the code, Lambda freezes the environment so that the same function can run quickly if invoked again. If you run the function concurrently, each invocation gets a cold start. There will also be a code start if the code is updated. The typical time for cold starts falls between 100 ms and 1 second. In light of the foregoing, Lambda falls short in the Lambda vs Fargate race regarding cold starts. However, Provisioned Concurrency is a solution to reduce cold starts.

The runtime choice will also have an impact on Lambda cold starts. For instance, Java runtime involves multiple resources to run the JVM environment, which delays the start. On the other hand, C# or Node.js runtime environments offer lower latencies.
Çözümler şöyle
1. Lambda Provisioned Concurrency
2. SnapStart

1. Lambda Provisioned Concurrency
Açıklaması şöyle. Yani sürekli çalışan lambda demek
In other words, this facilitates the creation of pre-warmed Lambdas waiting to serve incoming requests. As this is pre-provisioned, the configured number of provisioned environments will be up and running all the time even if there are no requests to cater to. Therefore, this contradicts the very essence of serverless environments. Also, since environments are provisioned upfront, this feature is not free and comes with a considerable price.
2. SnapStart
Açıklaması şöyle. Yani sürekli çalışmaya hazır lambda demek. “AWS console”—> “Configuration”—> “General Configuration”—> “Edit.” menüsünden etkinleştirmek gerekir.
With SnapStart, Lambda initializes your function when you publish a function version. Lambda takes a Firecracker micro VM snapshot of the memory and disk state of the initialized execution environment, encrypts the snapshot, and caches it for low-latency access. When you invoke the function version for the first time, and as the invocations scale up, Lambda resumes new execution environments from the cached snapshot instead of initializing them from scratch, improving startup latency. The best part is that, unlike provisioned concurrency, there is no additional cost for SnapStart. SnapStart is currently only available for Java 11 (Corretto) runtime.
Açıklaması şöyle
Lambda SnapStart for Java is a new feature that enables you to resume new execution environments from cached snapshots without initializing them from scratch. It helps improve startup latency. However, this feature is only available for Java 11-managed runtime environments. There are other limitations as well. It does not support provisioned concurrency, Amazon X-Ray, Amazon EFS, or arm64 architecture. Moreover, you cannot use ephemeral storage of more than 512 MB.



17 Şubat 2023 Cuma

AWS Simple Email Service - SES

Giriş
Açıklaması şöyle
Amazon Simple Email Service (SES) is an API for sending emails and managing email lists. SES’s main API endpoints are focused on sending emails and managing email contacts. The service also includes more advanced endpoints related to deliverability, like managing the dedicated IP addresses from which SES sends your emails.
Açıklama şöyle
The first thing you have to do is to add email identities to Amazon SES. It will only allow the registered email identities to send the emails. By default, your Amazon SES will be working on a sandbox environment. So you can only send the emails to the registered email identities. You can request AWS support to remove the sandbox environment.

7 Şubat 2023 Salı

aws komutu auto complete

Örnek - on-partial
Şöyle yaparız
[my-profile]
#...
cli_auto_prompt = on-partial

Örnek - on
Şöyle yaparız
[my-profile]
#...
cli_auto_prompt = onl

6 Şubat 2023 Pazartesi

AWS Aurora - AWS RDS'ten Biraz Daha Gelişmiştir

Giriş
Açıklaması şöyle. AWS RDS'ten Biraz Daha Gelişmiştir. Hem MySQL hem de PostgreSQL olarak kullanılabilir.
- MySQL & PostgresSQL compatible relational database.
- Provides 5x better performance than MySQL
- Provides 3x better performance than Postgres SQL
- Distributed, fault-tolerant, self-healing storage system
- 2 copies of your data is contained in each Availability Zone (AZ) — minimum of 3 AZ’s and 6 copies.
- Can handle the loss of up to 2 copies without affecting write ability.
- Can handle lose of up to 3 copies of data without affecting read ability.
- Automated backups always enabled — doesn’t impact performance.
Açıklaması şöyle
Amazon Aurora is an elevated version of Amazon RDS. Large enterprises use this since their data volume and complexity of operations are much higher. It doesn't support all the same database engines as Amazon RDS, and instead only supports MySQL and PostgreSQL. Aurora scales up and down as the load on your database increases and decreases. Newer providers like PlanetScale also offer this capability with additional schema migration features and lower costs.

Amazon Aurora, like RDS, can perform replication. It actually offers about 15 different types of replications, and one replication can be done within milliseconds. On the other hand, RDS can perform only five types of replications, taking more time.

Some of the use cases that can depict the strength of Amazon Aurora are enterprise applications, SaaS applications, and web/mobile gaming.
Benefits
  1. Auto-scaling allows scaling operations to be carried out automatically without affecting the DB performance. It allows up to 128 TB per database instance.
  2. Aurora backup operations are automatic, continuous, incremental, and have about 99.99999999% durability.
  3. Aurora can detect database failure and recover in less than a minute. Furthermore, in case of a permanent failure, it can automatically move to a replica without data loss.
Replication
Açıklaması şöyle
- It expands the Multi-AZ replicas from 2 to up to 15.
- It automatically copies data across six storage nodes in different AZs of the same region, even if you do not have any read replica.

Having more replicas gives you increased read capacity but also more options when promoting a read replica to become a new primary. The lag between the primary and the replica is usually less than 100 ms, which means there is still a chance of an outdated read after a write.

Even if you decide not to have a replica, the fact that you have copies of data stored automatically in different AZs helps to prevent data loss, albeit at the expense of a longer recovery time, as a new primary will be recreated in the event of failure with the existing one.

Capacity Type Settings in Amazon Aurora
Şu seçenekler mevcut
- Provisioned Capacity
- Serverless Capacity
Upgrade
Burada bir yazı var. Seçenekler şöyle
1. In-place upgrade
2. AWS Database Migration Service
3. Manual migration with PostgreSQL tools


2 Şubat 2023 Perşembe

Amazon Web Service (AWS) Cloud Watch - Bir Dashboard

Giriş
Açıklaması şöyle
AWS provides AWS Cloudwatch dashboards to build your own dashboards about your service metrics. 
Bazı olumsuzluklar şöyle. Cloud Watch yerine Grafana kullanılabilir.
.... there are many disadvantages with AWS Cloudwatch dashboards:

-  AWS resources identifiers are hard coded in dashboards

-  You have to duplicate dashboards per region and per AWS account

-  Cloudwatch dashboards are charged $3/dashboard/month (see pricing)
Alarm Kullanımı
Açıklaması şöyle
- Used for alarms and logging.
- Also integrated very deeply in many AWS services.
- With cloud watch, you can configure alarms to notify you or trigger automatic activity if service goes down, overloaded, or acting crazy.
- Cloud watch can be used with SNS to send alerts to end-points (e.g. email, SMS).

4 Ocak 2023 Çarşamba

aws configure seçeneği

Giriş
Yaratılan "Access Key" değerlerini içeri alır. Bu komutun sonucunda 
1. ~/.aws/credentials ve 
2. ~/.aws/config
isimli iki dosya oluşur

~/.aws/credentials Dosyası - Hassas Bilgileri İçerir
Örnek
[default]
aws_access_key_id=AKIAIOSFODNN7EXAMPLE
aws_secret_access_key=wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
~/.aws/credentials Dosyası - Profile ayarlarını içerir
[default] profile için komut seçeneğinde "--profile ..." parametresini belirmeye gerek yoktur

Örnek
[default]
region=us-west-2
output=json
Kullanım
Örnek
Şöyle yaparız
$ aws configure
(Replace your access key when prompted) AWS Access Key ID [None]: ABCDEFGHIAZBERTUCNGG (Replace your secret key when prompted) AWS Secret Access Key [None]: uMe7fumK1IdDB094q2sGFhM5Bqt3HQRw3IHZzBDTm (you can put your own availability zone here ) Default region name [None]: ap-south-1 Default output format [None]: json
Örnek
Şöyle yaparız
# to setup aws configuration for terraform
aws configure
AWS Access Key ID [None]: <PASTE>
AWS Secret Access Key [None]: <PASTE>

# to see, where are your credentials saved.
cat $HOME/.aws/credentials
configure sso seçeneği
Komutun detayları  burada. Single sign on içindir. 

Örnek - Profile İle Kullanım
Şöyle yaparız
> aws configure sso
SSO start URL [None]: https://foo.awsapps.com/start
SSO Region [None]: us-east-1
Attempting to automatically open the SSO authorization page in your default browser.
If the browser does not open or you wish to use a different device to authorize this 
request, open the following URL:

https://device.sso.us-east-1.amazonaws.com/

Then enter the code:

ABC-DEFG
The only AWS account available to you is: 123456789012
Using the account ID 123456789012
The only role available to you is: PowerUserAccess
Using the role name "PowerUserAccess"
CLI default client Region [None]: us-east-1
CLI default output format [None]: json
CLI profile name [PowerUserAccess-123456789012]: poweruser

To use this profile, specify the profile name using --profile, as shown:

aws s3 ls --profile poweruser
Şifrenin tarihi geçince şöyle yaparız
$ aws sso login 
Tüm çıktı şöyle
> aws s3 ls --profile poweruser

The SSO session associated with this profile has expired or is otherwise invalid. 
To refresh this SSO session run aws sso login with the corresponding profile.

> aws sso login --profile poweruser
Attempting to automatically open the SSO authorization page in your default browser.
If the browser does not open or you wish to use a different device to authorize this
request, open the following URL:

https://device.sso.us-east-1.amazonaws.com/

Then enter the code:

ABCD-EFGH
Successfully logged into Start URL: https://fooo.awsapps.com/start

> aws s3 ls --profile poweruser
...