debian cloud - building the debian amis

70
Debian-Cloud: EC2 AMIs James Bromberger <[email protected]>

Upload: jamesbromberger

Post on 07-Jul-2015

383 views

Category:

Software


6 download

DESCRIPTION

Debian GNU/Linux - the oficial AMIs on the AWS EC2 Cloud

TRANSCRIPT

Page 1: Debian Cloud - building the Debian AMIs

Debian-Cloud: EC2 AMIs

James Bromberger

<[email protected]>

Page 2: Debian Cloud - building the Debian AMIs

Agenda

• What is Debian

• What is AWS EC2

• A meander through block storage for EC2 instances

• Types of images

• Generating & distributing Debian’s AMIs

• Debuab Image lifecycle and security

• If there is time: Debian via Cloudfront CDN

Page 3: Debian Cloud - building the Debian AMIs

WHAT IS DEBIAN

Page 4: Debian Cloud - building the Debian AMIs

What is Debian

• Computer Operating System

– 14 CPU/kernel architectures

– 37,500 packages of software

– Translated into a bunch of languages

Page 5: Debian Cloud - building the Debian AMIs

What is Debian

• Primarily of free and open-source software

– GNU General Public License and many other licenses

Page 6: Debian Cloud - building the Debian AMIs

What is Debian

• Started 1993

– 21 years old now

• Democratic, volunteer organisation - ~1,000 people (please join!)

– Zero payed employees

Page 7: Debian Cloud - building the Debian AMIs

WHAT IS AWS EC2

Page 8: Debian Cloud - building the Debian AMIs

What is AWS and EC2

• AWS = Amazon Web Services

• EC2 = Elastic Compute Cloud– Virtual servers running Linux, Windows, BSD

• Started 2006

• Now with 11 Regions and 52 Edge Locations

• Compute, storage, platform, infrastructure – as-a-service– typically billed by the hour or by the month

Amazon EC2

Page 9: Debian Cloud - building the Debian AMIs

What is EC2

• Compute requires:

– CPU, Memory (RAM)

– Block Storage (disk)

– Network

– Automation & bootstrapping

– Self-service

instance

Amazon EBS

Amazon VPC

Page 10: Debian Cloud - building the Debian AMIs

What is EC2

• Amount of CPU & Memory is combined into “instance type”:

– Small

– Medium

– Large

– ...

instance

instance

instance

Page 11: Debian Cloud - building the Debian AMIs

What is EC2

• Several instance types are grouped into an “instance family”:

– General Purpose (balanced memory:cpu)

– Memory Optimised (more memory:cpu)

– CPU Optimised (more cpu:memory)

– Storage Optimised (more ‘ephemerial’ storage)

– GPU (CUDA, OpenCL)

– Cluster Nodes (10 GB/sec networking and more)

Page 12: Debian Cloud - building the Debian AMIs

What is EC2

• EC2 instance run on real servers!

instanceinstanceinstanceinstance

Total number of (hyperthread) CPU cores, each dedicated* to an instance

Disk inside the physical server is deemed ‘ephemeral’. Not raid, but is local to CPU and Memory. Different amounts of storage depending on instance type

RAM is dedicated to each instance

Each instance can send a certain number of packets per second

Page 13: Debian Cloud - building the Debian AMIs

A MEANDER THROUGH STORAGE

Page 14: Debian Cloud - building the Debian AMIs

Ephemeral (instance) Storage

instanceinstanceinstanceinstance

Page 15: Debian Cloud - building the Debian AMIs

Persistent (EBS) Storage

instanceinstanceinstanceinstance

Amazon EBS

Page 16: Debian Cloud - building the Debian AMIs

Persistent (EBS) Storage

instanceinstanceinstanceinstance

Amazon EBS

Page 17: Debian Cloud - building the Debian AMIs

Persistent (EBS) Storage

Amazon EBS

Mechanical disk

General Purpose SSD (GP2)

Provisioned IOPS (SSD)

Amazon S3

Page 18: Debian Cloud - building the Debian AMIs

Persistent (EBS) Storage

Amazon EBS

Mechanical disk

General Purpose SSD (GP2)

Provisioned IOPS (SSD)

Amazon S3

AFR of a typical standard HDDDesigned for 99.999% availability (5.26 min/yr)Single instance attach only (currently)1GB..1TB (currently)Your choice of file-systemOptional transparent encryption by AWSNetwork attached to your instance back in the EC2 environment

99.999999999% durabilityReplicated multiple times within the same RegionCheck-summed and re-check-summed periodicallyDesigned for 99.99% availability (SLA at 99.9%)Can be shared with other customers (specific, or all) unless AWS-encryptedCan be used to create a new EBS volumeEBS snapshots cannot be seen in your S3 buckets

Page 19: Debian Cloud - building the Debian AMIs

Persistent (EBS) Storage

Amazon EBS

Mechanical disk

General Purpose SSD (GP2)

Provisioned IOPS (SSD)

Amazon S3

AFR of a typical standard HDDDesigned for 99.999% availability (5.26 min/yr)Single instance attach only (currently)1GB..1TB (currently)Your choice of file-systemOptional transparent encryption by AWSNetwork attached to your instance back in the EC2 environment

99.999999999% durabilityReplicated multiple times within the same RegionCheck-summed and re-check-summed periodicallyDesigned for 99.99% availability (SLA at 99.9%)Can be shared with other customers (specific, or all) unless AWS-encryptedCan be used to create a new EBS volumeEBS snapshots cannot be seen in your S3 buckets

Page 20: Debian Cloud - building the Debian AMIs

Persistent (EBS) Storage

instanceinstanceinstanceinstance

Amazon EBS

Page 21: Debian Cloud - building the Debian AMIs

Instance stop w/EBS

instanceinstanceinstance

Amazon EBS

Page 22: Debian Cloud - building the Debian AMIs

Instance restart w/EBS

instanceinstanceinstance

Amazon EBS

instanceinstanceinstanceinstance

EBS volume(s) reattached, ephemeral volume(s) blank

Page 23: Debian Cloud - building the Debian AMIs

TYPES OF MACHINE IMAGES

Page 24: Debian Cloud - building the Debian AMIs

Amazon Machine Images

• AMI is “golden master”

• Start as many instances as you like*

AMI

instance

instance

instance

instance instance instance

Page 25: Debian Cloud - building the Debian AMIs

Ephemeral and EBS

• Why is the Ephemeral and EBS storage options important in AMIs?

Your root volume

/ -> persistent (EBS)/ -> transitory (Ephemeral)

Page 26: Debian Cloud - building the Debian AMIs

Ephemeral and EBS

• Why is the Ephemeral and EBS storage options important in AMIs?

Your root volume

1,000 systems for 24 hours, 8 GB EBS each in SYD: ~$30.85

Page 27: Debian Cloud - building the Debian AMIs

Ephemeral and EBS

• Why is the Ephemeral and EBS storage options important in AMIs?

Your root volume

1,000 systems for 24 hours, Ephemeral in SYD: $0

Page 28: Debian Cloud - building the Debian AMIs

Ephemeral and EBS

• Why is the Ephemeral and EBS storage options important in AMIs?

S3 backed AMIAmazon S3

snapshotEBS backed AMI

Page 29: Debian Cloud - building the Debian AMIs

CPU Architectures

• EC2 currently supports 2 architectures:

S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI

Page 30: Debian Cloud - building the Debian AMIs

Virtualisation Types

• EC2 uses (highly customised) Xen, and supports two virtualisation types:

Para-Virtualization

(threads)

HardwareVirtualization(emulation)

S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI

Page 31: Debian Cloud - building the Debian AMIs

Each Region is independentPara-

Virtualization(threads)

HardwareVirtualization(emulation)

S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI

S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI

S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI S3 backed AMIEBS backed AMI

US

East

1U

S W

est

1A

P...

Page 32: Debian Cloud - building the Debian AMIs

Now multiply that by:

• Wheezy

• Jessie

• Sarge

• ...

Page 33: Debian Cloud - building the Debian AMIs

• 2 architectures

• 2 virtualisation types

• 2 root volume types

• 11 Regions

• 3 Debian releases

= 198 images

(Plus images currently being end-of-lifed, experimented with, and used for other purposes)

Page 34: Debian Cloud - building the Debian AMIs

Current Debian AMIs: Squeeze (6)

Architecture EBS Backed S3 Backed

32 bit PVM Yes

64 bit PVM Yes

32 bit HVM

64 bit HVM

Page 35: Debian Cloud - building the Debian AMIs

Current Debian AMIs: Wheezy (7)

Architecture EBS Backed S3 Backed

32 bit PVM Yes

64 bit PVM Yes Yes

32 bit HVM

64 bit HVM Yes (experimental)

Page 36: Debian Cloud - building the Debian AMIs

Future Debian AMIs: Jessie (8)

Architecture EBS Backed S3 Backed

32 bit PVM

64 bit PVM Yes

32 bit HVM

64 bit HVM Yes Yes*

Page 37: Debian Cloud - building the Debian AMIs

Two ways of creating AMIs

Start from scratch

• Uses a fresh, blank volume, install as a debootstrap

Update existing

• Start existing instance, customise, create new image

Page 38: Debian Cloud - building the Debian AMIs

EBS Backed AMI overview

instance

volume

/

volume

/target

snapshot

EC2 API

Endpoint

AMI

Page 39: Debian Cloud - building the Debian AMIs

Let’s create a Jessie image

• Fire up an existing instance (easiest is to use an existing Debian AMI)

• Install git, debootstrap, python-boto, python-jsonschema, and some other python bits

– Configure your AWS IAM credentials for boto

• Grab bootstrap-vz from Github

Page 40: Debian Cloud - building the Debian AMIs

DEMO

Page 41: Debian Cloud - building the Debian AMIs

Distributing images globally

Each region has separate copies of AMIs

Page 42: Debian Cloud - building the Debian AMIs

Distributing images

Three “groups” of Regions:

• GovCloud

• Beijing

• Everywhere else*

Page 43: Debian Cloud - building the Debian AMIs

Debian AWS Accounts

Region AWS Account ID

Beijing 673060587306*

Gov Cloud 256493402735**

Standard Regions 379101102735

Page 44: Debian Cloud - building the Debian AMIs
Page 45: Debian Cloud - building the Debian AMIs

Community Shared AMIs

• Un-vetted by AWS

– Trojan horses

– Left over SSH keys in other accounts

– Cron jobs that go bump in the night

• Anyone can share any AMI under their control (provided they have access within their AWS account to do so – IAM Policy)

– Caveat emptor

Page 46: Debian Cloud - building the Debian AMIs
Page 47: Debian Cloud - building the Debian AMIs
Page 48: Debian Cloud - building the Debian AMIs

Pushing images to Marketplace

Vendor AWS

Account ID

Vendor Display Name

Product ID Version ID ASIN SKU Software by

Title Version Title

Release Notes

Short Description

Description Highlight1

Page 49: Debian Cloud - building the Debian AMIs
Page 50: Debian Cloud - building the Debian AMIs

IMAGE LIFECYCLE AND SECURITY

Page 51: Debian Cloud - building the Debian AMIs

AMI Lifecycle

Our aim is to keep the final point release AMI available for each Debian major release, starting from Squeeze:

• 6.0.10

• 7.7

Page 52: Debian Cloud - building the Debian AMIs

AMI Lifecycle

Wheezy 7.4

Wheezy 7.5

Wheezy 7.6

Wheezy 7.6.aws.

1

Wheezy 7.6.aws.2

Wheezy 7.7

Try to keep a 2 – 5 week overlap for point releases, then un-share for a period, then delete

Time

Occasionally security releases that are urgent in BASE images (AMIs) force additional version numbers out of step with Debian. This was shellshock,

Page 53: Debian Cloud - building the Debian AMIs

Security in base images

• EC2 instances may be deployed such that they don’t have direct access to fetch updates

• Administrators may chose not to install updates unattended

Page 54: Debian Cloud - building the Debian AMIs

Debian AMIs in US East 1

Page 55: Debian Cloud - building the Debian AMIs

Workflow overview

1. Generate AMIs in US East 12. Tag AMIs and Snapshot3. Test image in US East 14. Copy to all Standard Regions (python script)5. Mark AMI and Snapshot as Public (python script)6. Generate in Beijing and Gov Cloud, tag, mark public7. Generate signed message to the Debian-cloud mailing list, update wiki8. Wait a few days (for bugs to surface), then push to AWS Marketplace9. Announce deprecation of previous versions (typically 3 – 5 weeks notice)

in signed email to Debian-cloud ML10. After elapsed period, remove public sharing from AMI and Snapshots

(python script)11. A day or so later, deregister the AMI and delete the snapshot (python

script)

Page 56: Debian Cloud - building the Debian AMIs

What’s new in Jessie EC2 images

• Single Root IO Virtualisation (Enhanced Networking)

• Multiple Network Interfaces (ENI)

• Multiple sub-interfaces

• AWS CLI and python-boto installed in base image

• Cloud-init (since Wheezy 7.4)

Page 57: Debian Cloud - building the Debian AMIs

Cloud-init

• Insert this as “User Data”

• Can be embedded into CloudFormationtemplates

#cloud-config

package_update: true

package_upgrade: true

package_reboot_if_required: true

packages:

- pwgen

- less

locale: fr_FR.UTF-8

ssh_authorized_keys:

- ssh-rsa AAAAB3Nz....89dGp5 me@mykey1

- ssh-rsa AAAAB3Nz....89dGp5 me@mykey2

final_message: "The system is finally up,

after $UPTIME seconds"

Page 58: Debian Cloud - building the Debian AMIs

DEBIAN ON CLOUDFRONT CDN

Page 59: Debian Cloud - building the Debian AMIs

Debian Archive via CDN

• Default apt sources.listfor EC2 images uses cloudfront.debian.net

• Primarily for EC2 instances, but is active in all 52 Cloudfrontlocations world-wide

CloudFront

Page 60: Debian Cloud - building the Debian AMIs

Cloudfront.debian.net

• Each edge location is independent of all others

edge location

edge location

edge location

traditional server

Page 61: Debian Cloud - building the Debian AMIs

Cloudfront.debian.net

• However, Debian HTTP servers don’t put any cache advisory headers on how long objects (files) may be cached for; some of these are quite volatile, and some are very stable

edge location

edge location

edge location

traditional server

Page 62: Debian Cloud - building the Debian AMIs

Cloudfront.debian.net

• Luickly, Cloudfrontsupports “Cache behaviours”, mapping different URL paths to alternate origin servers

edge location

edge location

edge location

traditional server

Page 63: Debian Cloud - building the Debian AMIs

Cloudfront.debian.net

• Default: => S3 bucket

• /debian/ => ftp.us.debian.org

• /debian/dists => my proxy server edge location

edge location

edge location

http://ftp.us.debian.org

bucket

instancesElastic Load

Balancing

Page 64: Debian Cloud - building the Debian AMIs
Page 65: Debian Cloud - building the Debian AMIs
Page 66: Debian Cloud - building the Debian AMIs
Page 67: Debian Cloud - building the Debian AMIs
Page 68: Debian Cloud - building the Debian AMIs

Jessie on Ice(ie, Jessie is frozen)

Page 69: Debian Cloud - building the Debian AMIs

Debian 9:Stretch

Debian 10: Buster

1.1 (‘96)

1.2

1.3

2

2.1

2.2

3 (2002)

3.1

4

5

6

7

8 (2015)

Page 70: Debian Cloud - building the Debian AMIs

James BrombergerE: [email protected]: @JamesBrombergerL: https://www.linkedin.com/in/jamesbrombergerPerth, Australia

GPG: 4096R/9D85C53C 2011-11-29Key fingerprint = 8591 20FE 0D9F A6A5 B054 C775 AEC8 2874 9D85 C53C

https://github.com/JamesBromberger/bootstrap-vz

https://wiki.debian.org/Cloud/AmazonEC2Image

https://aws.amazon.com/marketplace/pp/B00AA27RK4

https://lists.debian.org/debian-cloud/