Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions Cloud Web App/DynamoDB.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# DynamoDB

Amazon DynamoDB is a nonrelational database that delivers reliable performance at any scale. It's a fully managed, multi-region, multi-master database that provides consistent single-digit millisecond latency, and offers built-in security, backup and restore, and in-memory caching.



## Task1: Create a New Table

1. In the console, click Service, then click DynamoDB.
2. Click Create table.
3. For Table name, type: Music
4. For primary key, type Artist and leave String selected.
5. Select **Add sorted key**, then in the new field type song and leave **String** selected. Your table will use default setting for indexes and provisioned capacity.
6. Click Create.



## Task2: Add Data

1. Click the Items tab, then click Create item.

2. For Artist String, type: Pink Floyd.

3. For song String, type: Money.

4. To create additional attribute, click the plus sign to the left of Song, then click append.

5. In the drop-down list, select String.

6. For the new attribute, enter:

In FIELD, type: Album

In VALUE, type: The Dark side of the Moon

7. ...



## Task3: Modify an Existing Item

1. Click Psy.
2. Change the Year from 2011 to 2012.
3. Click save.



## Task4: Query the table

1. Click the drop-down list showing Scan (located below the Create item button) and change it to Query.
2. Enter these details: Partition Key, Sort Key.
3. Click Start Search.
4. Click Add Filter.

## Task5: Delete the Table

Click the Delete table. On the confirmation panel, click Delete.
49 changes: 49 additions & 0 deletions Cloud Web App/Install an LAMP server on Amazon Linux.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
# Install LAMP server on Linux

## Prepare

1. Connect to instance.

2. Ensure that all of software packages are up to date, perform a quick software update on your instance. It is important to make sure that you have the latest security updates and bug fixes

`sudo yum update -y` is used to update source.

3. Install the lamp-mariadb10.2-php7.2 and php7.2 Amazon Linux Extras repositories to get the latest versions of the LAMP MariaDB and PHP packages for Amazon Linux 2.

`sudo amazon-linux-extras install -y lamp-mariadb10.2-php7.2 php7.2`

4. Install the Apache web server, MariaDB, and PHP software packages.

Use the **yum install** command to install multiple software packages and all related dependencies at the same time.

`sudo yum install -y httpd mariadb-server`

`yum info package_name` is used to view the current versions of packages.

5. Start the Apache web server.

`sudo systemctl start httpd`

6. Use the **systemctl** command to configure the Apache web server to start at each system boot.

`sudo systemctl enable httpd`

7. Add a security rule to allow inbound HTTP (port 80) connections to instance. By default, a **launch-wizard-N** security group was set up for your instance during initialization. This group contains a single rule to allow SSH connections.
1. Open the Amazon EC2 console at <https://console.aws.amazon.com/ec2/>.
2. Choose **Instances** and select your instance.
3. Under **Security groups**, choose **view inbound rules**.
4. You should see the following list of rules in your default security group
8. Test your web server.

## Test

1. Create a PHP file in the Apache document root.
2. In a web browser, type the URL of the file that you just created. This URL is the public DNS address of your instance followed by a forward slash and the file name.

## Secure the Database Server

1. Start the MariaDB server.
2. Run **mysql_secure_installation**.

## Install phpMyAdmin

18 changes: 18 additions & 0 deletions Cloud Web App/Launch VM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Launch VM

1. Launch an Amazon EC2 Instance

2. Configure your Instance

* Find a suitable system and click select
* Configure storage, tagging, and security settings
* choose an existing key pair or create a new key pair

3. Connect to instance

* Open terminal.

* Use `chmod 400 ~/.ssh/mykeypair.pem` to restrict permissions to your private SSH key.
* Use `ssh -i ~/.ssh/MyKeyPair.pem ec2-user@{IP_Address}` to connect instace.

4. Terminate Instace
22 changes: 22 additions & 0 deletions Cloud Web App/S3.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# S3

## Overview

Amazon Simple Storage Service(S3) is storage for the Internet. We can use S3 to store and retrive any amount of data at any time, from anywhere on the web.

## Create a bucket in Amazon S3

* In the **AWS Management Console**, on the Services menu, click S3, then configure it.
* Upload an object to the Bucket and make the object public.

## Create a Bucket Policy

* Click the name of your bucket at the top of the window.
* Click the Permissions tab.
* In the permission tab, click Bucket Policy.
* Copy the ARN of your Bucket to the clipboard.
* Click the **Policy Generator** to generate policy.

## Explore Versioning

Versioning is a mean of keeping multiple variants of an object in the same bucket.
7 changes: 7 additions & 0 deletions Cloud Web App/Virtualization.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Virtualization

Virtualization is technology that separates functions from hardware, while clouds rely on that split. It's easy to confuse the 2, particularly because they both revolve around creating useful environments from abstract resources.

The easiest way to describe the difference is from a purely Infrastructure-as-a-Service (IaaS) perspective. At the base of cloud computing is a stable operating system (like Linux). This is the layer that gives users independence across public, private, and hybrid environments. Assuming intranet access, internet access, or both is already established, virtualization is what creates clouds. Software called a hypervisor sits on top of physical hardware and abstracts the machine's resources. These resources can be raw processing power, storage, or cloud-based applications containing all the runtime code and resources required to deploy it.

*If the process stops here, it's not cloud computing—it's just virtualization*. Virtual resources need to be allocated into centralized pools before they're called clouds, and those clouds need to be orchestrated by management and automation software before it's considered cloud computing. Clouds deliver the added benefits of self-service access, automated infrastructure scaling, and dynamic resource pools, which most clearly distinguish it from traditional virtualization.
57 changes: 57 additions & 0 deletions Docker/Basic.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Why Docker?

## Major Infrastructure Shifts

* Mainframe to PC in 90's
* Baremental to Virtual in 00's
* Datacenter to Cloud in 10's



## What is Container

A container is a standard unit of software that packages up code and all its dependencies so the application runs quickly and reliably from one computing environment to another. A Docker container image is a lightweight, standalone, executable package of software that includes everything needed to run an application: code, runtime, system tools, system libraries and settings.

Containers also reduce management overhead. Because they share a common operating system, only a single operating system needs care and feeding for bug fixes, patches, and so on. This concept is similar to what we experience with hypervisor hosts: fewer management points but slightly higher fault domain. In short, containers are lighter weight and more portable than VMs.



## What are VMs

Virtual machines (VMs) are an abstraction of physical hardware, that would slice your one giant physical server into multiple ones. The *hypervisor* or *VMM (Virtual Machine Monitor)* provides the capability to run multiple Virtual Machines on one set of hardwar and each one of these VMs with have an OS (you need to have licenses, update and patch them and everything IT related you do with all of your regular computers).

Before containers showed up, we used to use VMs to host our application. With VMs, we were able to get a big server and slice it up to several VMs and have multiple computers and simulate a network.

## Vitual Machines VS Containers

Virtual machines and containers differ in several ways, but the primary difference is that containers provide a way to virtualize an OS so that multiple workloads can run on a single OS instance. With VMs, the hardware is being virtualized to run multiple OS instances. Containers’ speed, agility, and portability make them yet another tool to help streamline software development.

1. Size

2. Isolation

In VMs, each vm has a bundle of EFI, Kernel + INIT, user space, and it is a sandbox.

In containers, it is not secure enough

3. Boot time

![](https://cdn-images-1.medium.com/max/2000/1*xNGfejkg9pQ16orB7VAIjA.png)



## Image VS Container

Simply, the container is a runtime instance of a image, but it has a extra read-write layer. It includes one or a group of applications and the environment the applications relied.

## Terms

**Registry** A place to find and download Docker images.

**Layers** A Docker image is built up from a series of layers. Each layer represents an instruction in the image’s Dockerfile. Each layer except the last one is read-only.

**Container Image** It is simply a binary representation. It is just a bunch of bits on a filesystem. VMDK is a disk image and an OVA is an image for VM.

**Dockerfile** A text file that contains all the commands, in order, needed to build a given image. The [Dockerfile reference](https://docs.docker.com/engine/reference/builder) page lists the various commands and format details for Dockerfiles.

**Volume** A special Docker container layer that allows data to persist and be shared separately from the container itself. Think of volumes as a way to abstract and manage your persistent data separately from the application itself.
61 changes: 61 additions & 0 deletions Docker/Container.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
#Container

### check info

1. `docker container ls` shows us all containers that are currently **running**.
2. `docker container ls -a` shows us all containers that we **ran**.
3. `docker container diff <container ID>` shows a list of all the files that were added or changed to in the container.
4. `docker container commit <container ID>` commits the container and create an image out of it.

### run

1. `docker container run <image>` is used to run a image from local. If it is not exist in local, **docker engine** goes to its default **Docker Registry**, which is Docker Store, to look for an image named "hello-world". It finds the image there, pulls it down, and then runs it in a contianer.

this is pretty much just like running a virtual machine, except with a central repository of VM images.

![](https://training.play-with-docker.com/images/ops-basics-hello-world.svg)

2. `docker container [options] run <image> <command> `

This command is used to run the specified image, execute the command, shutdown the image and sent back to host OS.

Options:

* `—detach` will run the container in the background
* `—name` will give the continer a name

Example:

* `docker container run alpine ls -l` return the output of the `ls` command. When you call `run`, the Docker client finds the image(alpine in this case), creates the container and then runs a command in that container. When you run `docker container run alpine`, you provided a command(ls -l), so Docker executed this command inside the container for which you saw the directory listing. after the `ls` command finished, the container shut down.

![](https://training.play-with-docker.com/images/ops-basics-run-details.svg)

* `docker container run alpine echo "hello from alpine"`

It will output "hello from alpine". In this case, all of that happened pretty quickly and again our container exited.

Difference with VM:

Imagine booting up a virtual machine (VM), running a command and then killing it; it would take a minute or two just to boot the VM before running the command. A VM has to emulate a full hardware stack, boot an operating system, and then launch your app - it’s a virtualized *hardware* environment. Docker containers function at the application layer so they skip most of the steps VMs require and just run what is required for the app.

* `docker container run -it alpine /bin/sh` let us could use the interactive shell where we could type some commands. Docker has a facility for that by adding a flag to run the container in an interactive terminal.

* `docker container run —interactive —tty —rm ubuntu bash` is used to create a ubuntu container, enter into bash and remove it when exited.

![](https://training.play-with-docker.com/images/ops-basics-instances.svg)

To find out more about `run`, use `docker container run —help` to see a list of all flags it supports.

* `docker container start <container ID>`

* `docker container exec <container ID> ls`

3. `docker container exec` allows us to run a command line inside a container.

## stop

1. `docker container stop <container>` is used to stop a container.

## remove

1. `docker container rm <container>` could remove a container.
9 changes: 9 additions & 0 deletions Docker/Features.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Features

## Isolation

It is basically a sandbox for a process. The process runs in the container has its own proces, name space and cgroups.

This is a critical security concept in the world of Docker containers! Even though each `docker container run` command used the same alpine image, each execution was a separate, isolated container. Each container has a separate filesystem and runs in a different namespace; By default a container has no way of interactint with other containers, even those from the same image. Let's try another exercise to learn more about isolation.

![](https://training.play-with-docker.com/images/ops-basics-isolation.svg)
Loading