The most used AWS services
Tags: aws, devops, ec2, ecs
Published: 2022-03-24 06:29:56

Over 200 services are available through Amazon Web Services (AWS). Today I'm going to have a short introduction of some most used services in AWS 

---

## ECR: Amazon Container Registry

![ECR](https://d1d4edbalysybs.cloudfront.net/f363fa9ae7c9b17f55525135f3457d02ab5d7578/assets/ecr-how-it-works-light.png)

- it's a repository for docker images
- it stores, manages and deploys Docker container images

**Alternative Options:** Dockerhub, Nexus

#### **pros**:
- it integrates well with other AWS services like ECS, EKS 
-   - easy to  connect and configure with them
-   - notify when new image comes
-   - pull images automatically

### Some examples

- Push a docker image to ECR
```aws
ecr repo name : test

aws ecr get-login-password --region us-east-1 | dokcer login --username AWS --password-stdin 23842934.dkr.ecr.us-east-1.amazonaws.com

docker tag test:latest 23842934.dkr.ecr.us-east-1.amazonaws.com/test:latest

docker push 23842934.dkr.ecr.us-east-1.amazonaws.com/test:latest

```
---

## ECS: Elastic Container Service

![ECS](https://roi4cio.com/fileadmin/user_upload/Amazon_Elastic_Container_Service_scheme.png)

Amazon Elastic Container Service (Amazon ECS) is a container orchestration platform that runs and manages Docker containers, like what we do in Kubernetes, but it also does managing service that operates it and provisions hardware resources


#### Main sections

- **Cluster**: it's like a logical group of hardware resources (such as EC2s) 
- **Task**: it's a template that contains metadata bout how you should deploy your docker container onto a machine, like CPU, memory, port mapping, envs, ...
- **Service**: it's for advance use cases like auto-scaling, load-balancing, blue-green deployments, ...

#### Alternative options: EKS 


---

## EC2: Elastic Cloud Compute
It's like a remote computer and whenever you need it, tear it down or up. 
- It's extremely flexible
- security

**Alternative options:** Fargate

---

## Fargate
![fargate](https://d1.awsstatic.com/re19/FargateonEKS/Product-Page-Diagram_Fargate%402x.a20fb2b15c2aebeda3a44dbbb0b10b82fb89aa6a.png)

If you want to run your container 24x7 you'll be much better off running it on an EC2 instance.

However, if your containers only run briefly to complete a task and then exit, or if they scale up and down based on demand it will be much easier for you to run them in Fargate - you won't need to scale up and down the underlying EC2 cluster to support the load.

With Fargate you pay premium for the flexibility.

**Alternative options:** EC2

---

## S3: Amazon S3
![s3](https://d1.awsstatic.com/s3-pdp-redesign/product-page-diagram_Amazon-S3_HIW.cf4c2bd7aa02f1fe77be8aa120393993e08ac86d.png)

- it's designed for large-capacity, low-cost file storage
- it keeps files in one specific geographical region
- cost of storage and bandwidth are quite low

---

## Amazon CloudFront
![Amazon CloudFront](https://i.stack.imgur.com/eEDGb.png)

- it's a CDN (Content Delivery Network)
- data are at edge locations as close to users as possible
- the data served by CloudFront my or may not come from S3
- bandwidth cost is a little more
- if your user base is localized, you won't see too much to use CloudFront, but needs to choose the right location for your S3 bucket.

**Alternative options:** Cloudflare, Akamai, ...

---

## AWS CloudFormation
AWS CloudFormation is a service that helps you model and set up your AWS resources so that you can simplify infrastructure management, quickly replicate your infrastructure, and easily control and track changes to your infrastructure.

** Alternative options:** Terraform, Google Cloud Deployment Manager, Chef and Puppet, Ansible

* Ansible and AWS CloudFormation can complement each other rather than being alternatives. You can use Ansible to automate tasks and configurations on AWS instances.

---

## [LAMBDA](https://hackernoon.com/a-better-introduction-to-aws-lambda):
![lambda](https://d1.awsstatic.com/product-marketing/Lambda/Diagrams/product-page-diagram_Lambda-WebApplications%202.c7f8cf38e12cb1daae9965ca048e10d676094dc1.png)

- AWS Lambda is the AWS platform's event-driven serverless computing solution.
- With lambda functions (FaaS), you don't need to worry about the complexity in infrastructure and cluster or ECS
- You just upload your code and get an `arn` for your functionality.
- You can integrate Lambda with API Getaways.
- You can make a http service, new file, change db, send a message in queue,... 
- Lambda can be called with S3, Kinesis, DynamoDB, SQS, Api Gateway

**Alternative options:** Azure Functions and Google Cloud Functions

---

## DynamoDB
![dynamoDb](https://d1.awsstatic.com/product-marketing/DynamoDB/product-page-diagram_Amazon-DynamoDB.a8a97936b804de5abb83fec9329acd03dec33332.png)

 - It's a backend data store in AWS
 - DynamoDB is a NoSQL database

[Alternatives](https://db-engines.com/en/system/Amazon+DynamoDB%3BCassandra%3BMongoDB): MongoDB, Cassandra

---

## API Gateway
- Simply put, API gateway is to REST APIs with WebSocket support.
- Example: [Building a serverless React app using AWS Lambda, DynamoDB, and an API Gateway](https://medium.com/@gulikholmatova/building-a-serverless-react-app-using-aws-lambda-dynamodb-and-an-api-gateway-f846696f34cd)


---
### RDS
Amazon Relational Database Service (RDS) is a collection of managed services that makes it simple to set up, operate, and scale databases in the cloud.

- Amazon RDS Multi-AZ deployments provide enhanced availability for database instances within a single AWS Region. With Multi-AZ, your data is synchronously replicated to a standby in a different Availability Zone (AZ).

---
## AppSync
![appsync](https://d2908q01vomqb2.cloudfront.net/fc074d501302eb2b93e2554793fcaf50b3bf7291/2019/08/26/GraphQL-API-2.png)

Simply put, AppSync is to GraphQL interface, It makes it easy to build scalable GraphQL APIs and also makes short work of difficult tasks in API Gateway. 


---

## IAM: Identity and Access Management
it provides fine-grained access control across all of AWS. With IAM, you can specify who can access which services and resources, and under which conditions.

---

##CloudWatch
- It enables users to track, collect and analyze their performance and operational application data running on AWS services.
- It also provides unified dashboards, alarm systems and logs

**example** : send alarms to Slack

![Send alarms to Slack with CloudWatch](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/19u98tyoe1swj0mgf1os.png)

---
##Bastion Host
A bastion host is a server whose purpose is to provide access to a private network from an external network, such as the Internet. Because of its exposure to potential attack, a bastion host must minimize the chances of penetration.

----
##AWS Systems Manager Parameter Store

Parameter Store, a capability of AWS Systems Manager, provides secure, hierarchical storage for configuration data management and secrets management. You can store data such as passwords, database strings, Amazon Machine Image (AMI) IDs, and license codes as parameter values

---
### AWS SNS
Amazon Simple Notification Service (SNS) is a fully managed messaging service provided by AWS, enabling the decoupling of microservices and distributed systems by delivering messages to various endpoints or subscribers.

**Use Case**: Amazon SNS is commonly used for real-time notifications, distributed system communication, and application integration scenarios where decoupling and scalability are critical

**Example**:
A ride-sharing application uses Amazon SNS to send real-time notifications to drivers and passengers about ride requests, updates on driver location, and payment confirmations.


**Alternative options:** Google Cloud Pub/Sub and Microsoft Azure Service Bus.

---
Refs:

- [How to Deploy a Docker App to AWS using Elastic Container Service (ECS)](https://www.youtube.com/watch?v=zs3tyVgiBQQ)
- [https://cloud.netapp.com/blog/aws-ecs-vs-kubernetes-an-unfair-comparison](https://cloud.netapp.com/blog/aws-ecs-vs-kubernetes-an-unfair-comparison)
- [How to Deploy a Docker App to AWS using Elastic Container Service (ECS)](https://www.youtube.com/watch?v=zs3tyVgiBQQ)
- [(1) AWS EC2 vs ECS vs Lambda | Which is right for YOU?](https://www.youtube.com/watch?v=-L6g9J9_zB8)