# Domain 2: Security and Compliance

## <mark style="color:red;">**Define the AWS shared responsibility model**</mark>

### <mark style="color:yellow;">**AWS Shared Responsibility Model Explained**</mark>

This model denotes how security and compliance responsibilities are shared between AWS and the customer.

{% hint style="info" %}
Think of the Shared Responsibility Model as a partnership. AWS secures the foundation, and you secure what you put on it.
{% endhint %}

### <mark style="color:yellow;">**Customer's Responsibility on AWS**</mark>

#### <mark style="color:purple;">Depending on the AWS service used, the responsibility might vary:</mark>

* <mark style="color:orange;">**RDS:**</mark> AWS manages underlying infrastructure, database patching.
* <mark style="color:orange;">**Lambda:**</mark> AWS manages the infrastructure, OS, and application stack.
* <mark style="color:orange;">**EC2:**</mark> You manage guest OS, updates, and the application.

### <mark style="color:yellow;">**AWS Responsibilities**</mark>

AWS is responsible for the security of the cloud, including infrastructure, hardware, software, and facilities.

<figure><img src="https://4247064012-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFLaJdzZGSq1DpczuSySw%2Fuploads%2FWnlSvPsjcG4eboPVp0uq%2Fimage.png?alt=media&#x26;token=94b26530-7785-4c77-bba5-cabd7dab4c67" alt=""><figcaption></figcaption></figure>

#### <mark style="color:purple;">Who is responsible for patching the database in Amazon RDS?</mark>

> a) Customer\
> b) AWS

{% hint style="success" %}
b) AWS
{% endhint %}

***

## <mark style="color:red;">**Define AWS Cloud security and compliance concepts**</mark>

### <mark style="color:yellow;">**AWS Compliance Information**</mark>

AWS offers compliance controls like HIPPA and SOCs. Not all AWS services might comply with every standard.

{% hint style="info" %}
Compliance requirements might vary per AWS service and region.
{% endhint %}

### <mark style="color:yellow;">**Achieving Compliance on AWS**</mark>

#### <mark style="color:purple;">AWS offers different encryption options:</mark>

* <mark style="color:orange;">**In Transit:**</mark> Data encrypted while moving.

<figure><img src="https://4247064012-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFLaJdzZGSq1DpczuSySw%2Fuploads%2F4Gap0wGLn4YvYf5pVHwy%2Fimage.png?alt=media&#x26;token=7a7f43d9-401d-42e3-898a-00bdfbe2c874" alt="" width="563"><figcaption></figcaption></figure>

* <mark style="color:orange;">**At Rest:**</mark> Data encrypted while stored.

<figure><img src="https://4247064012-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFLaJdzZGSq1DpczuSySw%2Fuploads%2FerMT6xSgufGEvTI5wvm6%2Fimage.png?alt=media&#x26;token=16cfd1ec-7d54-4123-a59d-2630a9b60dfd" alt="" width="351"><figcaption></figcaption></figure>

#### <mark style="color:purple;">**Auditing and Reporting Services:**</mark>

AWS provides tools like Amazon CloudWatch, AWS Config, and AWS CloudTrail for monitoring, auditing, and reporting.

#### <mark style="color:purple;">**Least Privileged Access Concept:**</mark>

Always grant only the permissions required to perform a task.

***

## <mark style="color:red;">**AWS Identity and Access Management (IAM)**</mark>

AWS Identity and Access Management (IAM) allows you to securely control access to AWS resources.

It allows you to create and manage AWS users and groups and assign permissions to allow or deny their access to AWS resources.

#### <mark style="color:purple;">**Key IAM Entities:**</mark>

* **User:** Individual people, system users, or services that will be interacting with AWS.
* **Group:** A collection of IAM users. You can specify permissions for multiple users, which can make it easier to manage the permissions for those users.
* **Role:** Not tied to a specific user or group. Instead, roles are assumed by trusted entities, such as IAM users, applications, or AWS services like EC2.
* **Policies:** Documents defining permissions and can be attached to users, groups, or roles.

### <mark style="color:yellow;">**Best Practices**</mark>

#### <mark style="color:purple;">**Root vs. IAM User:**</mark>

* **Root User:** When you open an AWS account, you begin with a single sign-in identity that has complete access to all AWS services and resources. This is termed as the "root" user.

{% hint style="danger" %}
Don't use your AWS root user credentials to access AWS, and no one else should either. Instead, create individual IAM users.
{% endhint %}

#### <mark style="color:purple;">**Access Keys:**</mark>

Access keys consist of an access key ID and secret access key, used to sign programmatic requests to AWS.

#### <mark style="color:purple;">**Password Policies:**</mark>

Set requirements for IAM user passwords.

#### <mark style="color:purple;">**Multi-Factor Authentication (MFA):**</mark>

Uses multiple factors to authenticate a user, adding an extra layer of security.

### <mark style="color:yellow;">**Deep Dive into IAM Roles, Users, and Groups**</mark>

#### <mark style="color:purple;">**Roles:**</mark>&#x20;

Instead of being uniquely associated with one person, a role is intended to be assumable by anyone who needs it.

* <mark style="color:orange;">**Example:**</mark> An EC2 instance might need access to an S3 bucket. Instead of hardcoding AWS credentials, you'd assign the EC2 instance an IAM role with the necessary permissions.

#### <mark style="color:purple;">**Users:**</mark>&#x20;

Intended for humans or services. They have permanent long-term credentials.

* <mark style="color:orange;">**Example:**</mark> A developer named `John` in your team might have a user account with permissions to access only specific S3 buckets and EC2 instances.

#### <mark style="color:purple;">**Groups:**</mark>&#x20;

A way to assign policies to multiple users simultaneously.

* <mark style="color:orange;">**Example:**</mark> If you have a group of developers, rather than assign each of them permissions, you'd place them in an `Developers` group and assign the necessary permissions to that group.

### <mark style="color:yellow;">**IAM Permission Policies**</mark>

#### <mark style="color:purple;">**Managed Policies:**</mark>

&#x20;AWS managed policies are designed to provide permissions for many common use cases. AWS controls these.

* <mark style="color:orange;">**Example:**</mark> `AmazonS3ReadOnlyAccess` – Provides read-only access to all buckets via the AWS Management Console.

#### <mark style="color:purple;">**Custom Policies:**</mark>&#x20;

You define custom permissions according to your needs.

* <mark style="color:orange;">**Example:**</mark> A policy that allows a user to only read a specific S3 bucket and not any other bucket.

<figure><img src="https://4247064012-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFLaJdzZGSq1DpczuSySw%2Fuploads%2FkC94ETvUTH5xWSMI79Vw%2Fimage.png?alt=media&#x26;token=2daa2b22-ecdd-4d85-8550-c8e0cd747caf" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
Never use the root account for daily tasks.&#x20;
{% endhint %}

***

## <mark style="color:red;">**Identify resources for security support**</mark>

### <mark style="color:yellow;">**Network Security Capabilities**</mark>

AWS offers tools like security groups, Network ACLs, and AWS WAF. Also, 3rd party security products are available on the AWS Marketplace.

### <mark style="color:yellow;">**Finding Documentation**</mark>

#### <mark style="color:purple;">Access resources such as:</mark>

* AWS Knowledge Center
* Security Center
* Security forum
* Security blogs

<figure><img src="https://4247064012-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFLaJdzZGSq1DpczuSySw%2Fuploads%2FWSw4otwJJsPv5TmWuCAP%2Fimage.png?alt=media&#x26;token=8c9a88bf-2b4b-48b6-a1ac-2cf6643b7b2f" alt=""><figcaption></figcaption></figure>

#### <mark style="color:purple;">Where can you find official AWS security best practices?</mark>

> a) Google\
> b) AWS Knowledge Center\
> c) Random blogs\
> d) Reddit

{% hint style="success" %}
b) AWS Knowledge Center
{% endhint %}

### <mark style="color:yellow;">**AWS Trusted Advisor**</mark>

This tool offers insights to follow best practices, including security checks.

<figure><img src="https://4247064012-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FFLaJdzZGSq1DpczuSySw%2Fuploads%2FHqjt6JKdzxY65A0E5O2f%2Fimage.png?alt=media&#x26;token=c65f7a85-7a22-4fc4-a85d-73c091a85dc6" alt=""><figcaption></figcaption></figure>
