15
Lecture 3 Hands-on Cloud Computing Services Gabriele Russo Russo

Hands-on Cloud Computing Services

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Lecture 3Hands-on Cloud Computing Services

Gabriele Russo Russo

Summary of previous lecture

I Amazon S3I AWS CLII boto3: AWS SDK for PythonI Ansible

2

Remarks for Windows users

I Some of you experienced issues using AWS CLI within PowerShell: youmay want to check an alternative tool for PowerShellhttps://aws.amazon.com/it/powershell/

I Ansible is not available on Windows. You can:I Use an EC2 instance to install AnsibleI Use a Linux VM

3

Ansible: dynamic inventory

I Ansible requires an inventoryI Not necessarily a static fileI AWS Inventory Source: run your playbooks using (a subset of) your

EC2 instances as target hosts (e.g., filtered by tag)I Requires Ansible 2.9+I A plugin required, easy to install:

$ ansible-galaxy collection install amazon.aws

4

Ansible: AWS inventory

I Create a YAML file (name MUST end with aws_ec2.(yml|yaml)→ galleryInventory.aws_ec2.yaml

I Test: ansible-inventory -i galleryInventory.aws_ec2.yaml--graph

I Run the playbook with:ansible-playbook -i galleryInventory.aws_ec2.yaml--private-key=path/to/key.pem -u ec2-userdeploy_gallery.yaml

5

AWS: Database services

AWS provides several database services. Among them:

I RDS (Relational Database Service)I DynamoDB (Key-Value NoSQL tables)I ElastiCache (in-memory databases: Memcached, Redis)I Neptune (graph database)

We’ll use DynamoDB to store picture metadata in PhotoGallery

6

AWS: Database services

AWS provides several database services. Among them:

I RDS (Relational Database Service)I DynamoDB (Key-Value NoSQL tables)I ElastiCache (in-memory databases: Memcached, Redis)I Neptune (graph database)

We’ll use DynamoDB to store picture metadata in PhotoGallery

6

DynamoDB

I SchemalessI Tables, Items, AttributesI Primary Key + (optional) Sorting KeyI 2 pricing models:

I provisioned capacity (default)I on-demand

I 2 consistency models:I eventualI strong

Example: dynamodb_create.sh, dynamodb_example.py

7

Photogallery + DynamoDB

I SchemalessI Tables, Items, AttributesI Primary Key + (optional) Sorting KeyI 2 pricing models:

I provisioned capacity (default)I on-demand

I 2 consistency models (cons./cost/performance trade-off):I eventualI strong

See: photogallery_v4

8

Photogallery: overview

9

CloudFront

I CDN provided by AWSI Easy to integrate with S3 buckets and ELBs

How to use it in Photogallery:I Create a distribution for our S3 bucketI Replace picture URLs as follows:

http://bucketname.s3.amazonaws.com/imagename.jpghttp://distributionname.cloudfront.net/imagename.jpg

Note: to delete a distribution, you need to Disable it first (and wait acouple of minutes)

10

Route 53

I DNS service by AWSI Register a domain nameI Fine-grained control over your DNS zoneI Extra features (e.g., latency-based query handling)

11

Elastic IP

I Public IP addresses associated to EC2 instances as neededI You can change the associated instance on-the-flyI May be useful in some situations

12

Let’s reason about...money

I AWS provides a “cost calculator”I https://calculator.s3.amazonaws.com/index.html

13

Exercises

I Create a static personal website using S3 and CloudFront (no EC2instances)

I Extend PhotoGallery:I Search pics by tag

14