Archive for April, 2017

 

Services-EC2-Instances-Volumes

1.PNG

Create volume

2.png

Chose Volume Type and size

 

3

Then in actions menu choose Attach Volume

 

4.png

Choose instance and click attach

 

5

Now connect to VM and type lsblk to check if drive is initialized on guest OS

6.png

Create file system and mount drive

mkfs –t ext4 /dev/xvdf
mkdir /mounts
mount /dev/xvdf /mounts

Open the Settings app and head to Update & Security > For Developers

1.png

2.png

Open the Control Panel, click Programs-Turn Windows Features On or Off under Programs and Features. Enable the Windows Subsystem for Linux (Beta)-click OK

4

Reboot computer

In search box type bash

5

Type Y

6

You’ll be asked for username/password

Bash on Ubuntu on Windows shortcut will be created

1

Connecting to Amazon VM

chmod 400 /mnt/c/Users/dragan/Desktop/mykeys.pem  #(mykeys.pem are private keys downloaded to my Desktop from AWS during creating VM)
ssh ec2-user@52.210.96.140 -i /mnt/c/Users/dragan/Desktop/mykeys.pem

 

1.png

In previous post we created linux VM, and downloaded private key (mykeys.pem) now we’ll connect to it from Windows by PuTTY

Download PutTTY from here

Run PuTTY gen (to convert pem file to ppk-so we can import it in PuTTY)

1.png

Click Load

2

Point it to Private key we downloaded from AWS console during creating VM.

3.png

4

Now click save private key

5

If you wish to set passphrase click No and set it,otherwise,click Yes

6.PNG

Then click Save Private Key to save keys with ppk extension

8

Now copy VM’s public IP

9.png

Open PuTTY-expand SSH-Auth-browse to ppk file

10

type username (ec2-user in my case)@public IP address

1.png

12.PNG

 

13.PNG

During machine creation i created basic network access rules (ssh access only to VM’s IP-HTTP/HTTPS  to any address (0.0.0.0/0)

 

Capture

 

Install apache

yum install httpd -y

service httpd start

Test web access

 

14.PNG

In AWS click EC2 under Compute

 

1.png

Launch Instance

2.png

Choose Amazon Machine Image (i chose Amazon Linux)

 

3.PNG

Select Instance

 

4.png

Choose subnet (every Availability zone has its own subnet)

 

5.png

 

6.PNG

Choose HDD size and type (General Purpose SSD (IO1)-used for VM with high Input-Output)

 

7.png

Add tag (machine name,creator,owner….)

 

8.png

 

9.PNG

Consider security group as a firewall (choose which services to enable and access to it (source and destination IP)

 

10.PNG

Create new key pair (public and private key) click download

 

11.png

 

 

12.PNG

 

13.PNG

Content Delivery Network (CDN) is a system that delivers web content to users based on geographical location.When user first time asks for content,it’s downloaded to Edge Location (location where content will be downloaded),all subsequent download request will go to Edge Location.Windows Branch Cache would be considered as analogy.

From AWS console click CloudFront,under Network & Content Delivery

 

1.png

 

Click create Distribution

 

2.PNG

We have 2 methods:

Web and RTMP (streaming media)

 

Capture.PNG

 

 

Click Origin Domain Name,all options will be shown-choose bucket which you want to distribute (cache)

 

3.png

Origin path:specify folders/subfolders in bucket

Restrict bucket access-Yes-force using CloudFront URL

Origin Access Identity –creates new user and applies permissions to that user

Grant Read Permissions on Bucket-Yes

Capture

GET, HEAD, OPTIONS, PUT, POST, PATCH, DELETE – allows upload content to edge location

TTL-how long content will be cached on Edge Location

If cached content is removed manually, you’ll be charged

 

Capture.PNG

When done configuring click Create Distribution

Then click Distributions

5.png

Deployement takes some time

 

6.PNG

Remove permissions from file in Bucket

 

 

7

As expected, access is denied now

9

Now go to Distribution we just created:

Services-Cloudfront-click on CloudFront Distribution-Copy Domain Name

8.png

 

Now go to bucket file-properties-click on download link again

replace https://s3-sa-east-1.amazonaws.com/cdntestbucket2017/aws.docx

with http://d1x295lm4zxiz1.cloudfront.net/aws.docx

Using CloudFront URL instead S3 URL we can access bucket file.

 

10.PNG

Cross-region replication on AWS enables automatic, asynchronous copying of objects across buckets in different AWS regions

In this example i have 2 buckets:

on in Frankfurt and other in London,i want yo replicate content of Frankfurt bucket to London one.

 

 

Capture.PNG

 

Prerequisite for replication is that on source and destination bucket version must be enabled.

2.PNG

 

3.PNG

Enabling replication

On source bucket (mytestbucket20017 in my case) go to properties-Cross-region replication,specify source region and would you like to replicate whole bucker or just specific folder/subfolder (Prefix) and destination region and bucket

 

4.png

 

We need to specify storage class and create new role (to associate source bucket with destination one)

 

5.PNG

 

But,have in mind that already present objects in source bucket won’t be replicated, only new uploaded one, version info will be replicated also (if any exist)

If we delete file from bucket in AWS, we can restore it only from old AWS console

Let’s first delete file from bucket:

Click on file-More-Delete1.png

Service-S3-Switch to the old console

 

2

Click on bucket

 

3.PNG

Click Show-Select deleted file

 

4

Click Actions-Delete

 

5

To return to new console click Services-S3

6.png

Click Opt In in the right side

7

 

8