From 48db2d4664440350f36cbfc1b519651f6a436694 Mon Sep 17 00:00:00 2001 From: Arie Bregman Date: Thu, 25 Aug 2022 09:17:29 +0300 Subject: [PATCH] Update --- README.md | 20 +- topics/aws/README.md | 188 +++++++++++------- .../aws/exercises/s3/new_bucket/exercise.md | 15 ++ .../s3/new_bucket/pulumi/__main__.py | 28 +++ .../aws/exercises/s3/new_bucket/solution.md | 43 ++++ .../exercises/s3/new_bucket/terraform/main.tf | 40 ++++ 6 files changed, 257 insertions(+), 77 deletions(-) create mode 100644 topics/aws/exercises/s3/new_bucket/exercise.md create mode 100644 topics/aws/exercises/s3/new_bucket/pulumi/__main__.py create mode 100644 topics/aws/exercises/s3/new_bucket/solution.md create mode 100644 topics/aws/exercises/s3/new_bucket/terraform/main.tf diff --git a/README.md b/README.md index fd90189..79642c4 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ cicd
CI/CD
Git
Git
ansible
Ansible
- Network
Network
+ Network
Network
Linux
Linux
@@ -244,6 +244,20 @@ CSMA/CD algorithm: * hub
+
+What is a "Collision Domain"?
+
+ +
+What is a "Broadcast Domain"?
+
+ +
+three computers connected to a switch. How many collision domains are there? How many broadcast domains?
+ +Three collision domains and one broadcast domain +
+
How does a router works?
@@ -407,6 +421,10 @@ For example, your computer's private IP could be 192.168.1.100, but your router * SFTP - 22
+
+Which factors affect network performances
+
+ #### Network - Data and Control planes
diff --git a/topics/aws/README.md b/topics/aws/README.md index 0d1e2c8..632df90 100644 --- a/topics/aws/README.md +++ b/topics/aws/README.md @@ -1,12 +1,14 @@ # AWS -**Note**: Provided solutions are using the AWS console. It's recommended you'll use IaC technologies to solve the exercises (e.g. Terraform, Pulumi).
-**2nd Note**: Some of the exercises cost $$$ and can't be performed using the free tier/resources +**Note**: Some of the exercises cost $$$ and can't be performed using the free tier/resources + +**2nd Note**: Provided solutions are using the AWS console. It's recommended you'll use IaC technologies to solve the exercises (e.g. Terraform, Pulumi).
- [AWS](#aws) - [Exercises](#exercises) - [IAM](#iam) - [EC2](#ec2) + - [S3](#s3) - [ELB](#elb) - [Auto Scaling Groups](#auto-scaling-groups) - [VPC](#vpc) @@ -33,10 +35,12 @@ - [Containers](#containers-1) - [ECS](#ecs) - [Fargate](#fargate) - - [S3](#s3) + - [S3](#s3-1) - [Basics](#basics) - - [Buckets](#buckets) + - [Buckets 101](#buckets-101) + - [Objects](#objects) - [Security](#security) + - [Misc](#misc-1) - [Disaster Recovery](#disaster-recovery) - [CloudFront](#cloudfront) - [ELB](#elb-1) @@ -55,12 +59,12 @@ - [Monitoring and Logging](#monitoring-and-logging) - [Billing and Support](#billing-and-support) - [Automation](#automation) - - [Misc](#misc-1) + - [Misc](#misc-2) - [High Availability](#high-availability) - [Production Operations and Migrations](#production-operations-and-migrations) - [Scenarios](#scenarios) - [Architecture Design](#architecture-design) - - [Misc](#misc-2) + - [Misc](#misc-3) ## Exercises @@ -91,6 +95,11 @@ | Create an AMI | EC2, AMI | [Exercise](exercises/create_ami/exercise.md) | [Solution](exercises/create_ami/solution.md) | | | Create EFS | EC2, EFS | [Exercise](exercises/create_efs/exercise.md) | [Solution](exercises/create_efs/solution.md) | | +### S3 + +|Name|Topic|Objective & Instructions|Solution|Comments| +|--------|--------|------|----|----| +| Create buckets | S3 | [Exercise](exercises/s3/new_bucket/exercise.md) | [Solution](exercises/s3/new_bucket/solution.md) ### ELB |Name|Topic|Objective & Instructions|Solution|Comments| @@ -1116,6 +1125,8 @@ True. - As a user you don't have to worry about filesystems or disk space
+#### Buckets 101 +
What is a bucket?
@@ -1123,22 +1134,68 @@ An S3 bucket is a resource which is similar to folders in a file system and allo
-Explain folders and objects in regards to buckets
+True or False? Buckets are defined globally
-* Folder - any sub folder in an s3 bucket -* Object - The files which are stored in a bucket +False. They are defined at the region level. +
+ +
+True or False? A bucket name must be globally unique
+ +True +
+ +
+How to rename a bucket in S3?
+ +A S3 bucket name is immutable. That means it's not possible to change it, without removing and creating a new bucket. + +This is why the process for renaming a bucket is as follows: + +* Create a new bucket with the desired name +* Move the data from the old bucket to it +* Delete the old bucket + +With the AWS CLI that would be: + +```sh +# Create new bucket +aws s3 mb s3://[NEW_BUCKET_NAME] +# Sync the content from the old bucket to the new bucket +$ aws s3 sync s3://[OLD_BUCKET_NAME] s3://[NEW_BUCKET_NAME] +# Remove old bucket +$ aws s3 rb --force s3://[OLD_BUCKET_NAME] +``` +
+ +
+True or False? The max object size a user can upload in one go, is 5TB
+ +True +
+ +
+Explain "Multi-part upload"
+ +[Amazon docs](https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html): "Multipart upload allows you to upload a single object as a set of parts. Each part is a contiguous portion of the object's data...In general, when your object size reaches 100 MB, you should consider using multipart uploads instead of uploading the object in a single operation." +
+ +#### Objects + +
+Explain "Object Versioning"
+ +When enabled at a bucket level, versioning allows you to upload new version of files, overriding previous version and so be able to easily roll-back and protect your data from being permanently deleted.
Explain the following: - Object Lifecycles - - Object Sharing - - Object Versioning
+ - Object Sharing
* Object Lifecycles - Transfer objects between storage classes based on defined rules of time periods * Object Sharing - Share objects via a URL link - * Object Versioning - Manage multiple versions of an object
@@ -1148,6 +1205,49 @@ Object Durability: The percent over a one-year time period that a file will not Object Availability: The percent over a one-year time period that a file will be accessible
+#### Security + +
+True or False? Every new S3 bucket is public by default
+ +False. A newly created bucket is private unless it was configured to be public. +
+ +
+What's a presigned URL?
+ +Since every newly created bucket is by default private it doesn't allows to share files with users. Even if the person who uploaded them tries to view them, it gets denied. + +A presigned URL is a way to bypass that and allow sharing the files with users by including the credentials (token) as part of the URL. It can be done for limited time. +
+ +
+What security measures have you taken in context of S3?
+ * Don't make a bucket public. + * Enable encryption if it's disabled. + * Define an access policy +
+ +
+True or False? In case of SSE-AES encryption, you manage the key
+ +False. S3 manages the key and uses AES-256 algorithm for the encryption. +
+ +
+True or False? In case of SSE-C encryption, both S3 and you manage the keys
+ +False. You manage the keys. It's customer provided key. +
+ +
+True or False? Traffic between a host an S3 (e.g. uploading a file) is encrypted using SSL/TLS
+ +True +
+ +#### Misc +
What is a storage class? What storage classes are there?
@@ -1250,70 +1350,6 @@ Learn more [here](https://docs.aws.amazon.com/AmazonS3/latest/dev/transfer-accel No. S3 support only statis hosts. On a static website, individual webpages include static content. They might also contain client-side scripts. By contrast, a dynamic website relies on server-side processing, including server-side scripts such as PHP, JSP, or ASP.NET. Amazon S3 does not support server-side scripting.
-#### Buckets - -
-True or False? A bucket name must be globally unique
- -True -
- -
-How to rename a bucket in S3?
- -A S3 bucket name is immutable. That means it's not possible to change it, without removing and creating a new bucket. - -This is why the process for renaming a bucket is as follows: - -* Create a new bucket with the desired name -* Move the data from the old bucket to it -* Delete the old bucket - -With the AWS CLI that would be: - -```sh -# Create new bucket -aws s3 mb s3://[NEW_BUCKET_NAME] -# Sync the content from the old bucket to the new bucket -$ aws s3 sync s3://[OLD_BUCKET_NAME] s3://[NEW_BUCKET_NAME] -# Remove old bucket -$ aws s3 rb --force s3://[OLD_BUCKET_NAME] -``` -
- -#### Security - -
-True or False? Every new S3 bucket is public by default
- -False -
- -
-What security measures have you taken in context of S3?
- * Don't make a bucket public. - * Enable encryption if it's disabled. - * Define an access policy -
- -
-True or False? In case of SSE-AES encryption, you manage the key
- -False. S3 manages the key and uses AES-256 algorithm for the encryption. -
- -
-True or False? In case of SSE-C encryption, both S3 and you manage the keys
- -False. You manage the keys. It's customer provided key. -
- -
-True or False? Traffic between a host an S3 (e.g. uploading a file) is encrypted using SSL/TLS
- -True -
- ### Disaster Recovery
diff --git a/topics/aws/exercises/s3/new_bucket/exercise.md b/topics/aws/exercises/s3/new_bucket/exercise.md new file mode 100644 index 0000000..90ea47c --- /dev/null +++ b/topics/aws/exercises/s3/new_bucket/exercise.md @@ -0,0 +1,15 @@ +# Create buckets + +## Objectives + +1. Create the following buckets: + 1. Private bucket + 1. eu-west-2 region + 2. Upload a single file to the bucket. Any file. + 2. Public bucket + 1. eu-west-1 region + 2. Versioning should be enabled + +## Solution + +Click [here](solution.md) to view the solution \ No newline at end of file diff --git a/topics/aws/exercises/s3/new_bucket/pulumi/__main__.py b/topics/aws/exercises/s3/new_bucket/pulumi/__main__.py new file mode 100644 index 0000000..c400074 --- /dev/null +++ b/topics/aws/exercises/s3/new_bucket/pulumi/__main__.py @@ -0,0 +1,28 @@ +import pulumi +import pulumi_aws as aws + +# Private Bucket +private_bucket = aws.s3.Bucket("my-first-private-bucket", + acl="private", + tags={ + "Environment": "Exercise", + "Name": "My First Private Bucket"}, + region="eu-west-2" + ) + +# Bucket Object + +aws.s3.BucketObject("bucketObject", + key="some_object_key", + bucket=private_bucket.id, + content="object content") + +# Public Bucket +aws.s3.Bucket("my-first-public-bucket", + acl="private", + tags={ + "Environment": "Exercise", + "Name": "My First Public Bucket"}, + region="eu-west-1", + versioning=aws.s3.BucketVersioningArgs(enabled=True) + ) \ No newline at end of file diff --git a/topics/aws/exercises/s3/new_bucket/solution.md b/topics/aws/exercises/s3/new_bucket/solution.md new file mode 100644 index 0000000..4dc51cd --- /dev/null +++ b/topics/aws/exercises/s3/new_bucket/solution.md @@ -0,0 +1,43 @@ +# Create buckets + +## Objectives + +1. Create the following buckets: + 1. Private bucket + 1. eu-west-2 region + 2. Upload a single file to the bucket. Any file. + 2. Public bucket + 1. eu-west-1 region + 2. Versioning should be enabled + +## Solution + +### Console + +For the first bucket: + +1. Go to S3 service in the AWS console. If not in buckets page, click on "buckets" in the left side menu +2. Click on "Create bucket" +3. Give a globally unique name for your bucket +4. Choose the region "eu-west-2" +5. Click on "Create bucket" +6. Click on the bucket name +7. Under "objects" click on "Upload" -> "Add files" -> Choose file to upload -> Click on "Upload" + +For the second bucket: + +1. Go to S3 service in the AWS console. If not in buckets page, click on "buckets" in the left side menu +2. Click on "Create bucket" +3. Give a globally unique name for your bucket +4. Choose the region "eu-west-1" +5. Make sure to uncheck the box for "Private bucket" to make it public +6. Make sure to check the enable box for "Bucket Versioning" +7. Click on "Create bucket" + +### Terraform + +Click [here](terraform/main.tf) to view the solution + +### Pulumi - Python + +Click [here](pulumi/__main__.py) to view the solution \ No newline at end of file diff --git a/topics/aws/exercises/s3/new_bucket/terraform/main.tf b/topics/aws/exercises/s3/new_bucket/terraform/main.tf new file mode 100644 index 0000000..312da4d --- /dev/null +++ b/topics/aws/exercises/s3/new_bucket/terraform/main.tf @@ -0,0 +1,40 @@ +resource "aws_s3_bucket" "private_bucket" { + bucket = "my-first-private-bucket" + region = "eu-west-2" + acl = "private" + + tags = { + Name = "My First Private Bucket" + Environment = "Exercise" + } +} + +resource "aws_s3_bucket_acl" "private_bucket_acl" { + bucket = aws_s3_bucket.private_bucket.id + acl = "private" +} + +resource "aws_s3_bucket" "public_bucket" { + bucket = "my-first-public-bucket" + region = "eu-west-1" + + tags = { + Name = "My First Public Bucket" + Environment = "Exercise" + } + + versioning { + enabled = true + } +} + +resource "aws_s3_bucket_acl" "public_bucket_acl" { + bucket = aws_s3_bucket.public_bucket.id + acl = "public-read" +} + +resource "aws_s3_bucket_object" "bucket_object" { + bucket = "my-first-private-bucket" + key = "some_object_key" + content = "object content" +} \ No newline at end of file