SlideShare a Scribd company logo
1 of 60
Download to read offline
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Care and Feeding of
Amazon Linux
iliana weller (she/her)
Linux Witch
Containers and Linux, AWS
C O N 4 0 4
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Amazon Linux?
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
What is Amazon Linux?
• Linux operating system, optimized for AWS
• AWS feature launches and new Amazon Elastic Compute Cloud
(Amazon EC2) instance types from day 1
• Amazon Linux 2 released June 26, 2018
• Amazon Linux AMI (aka Amazon Linux 1) released 2011, EOL 2020
• Universal availability
• AMIs for use on Amazon EC2
• Container images
• On-premises virtualization images
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
Lifecycle of a Linux distribution
Inspecting Amazon Linux source RPMs
Safely pushing Amazon Linux repositories
Building Linux container images and AMIs
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Online resources
https://iweller.people.a2z.com/con404/
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
Lifecycle of a Linux distribution
Inspecting Amazon Linux source RPMs
Safely pushing Amazon Linux repositories
Building Linux container images and AMIs
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lifecycle of a Linux distribution
×
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Lifecycle of Amazon Linux
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
Lifecycle of a Linux distribution
Inspecting Amazon Linux source RPMs
Safely pushing Amazon Linux repositories
Building Linux container images and AMIs
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Inspecting source RPMs
$ sudo yum install -y yum-utils rpmdevtools
$ yumdownloader --source amazon-linux-extras
amazon-linux-extras-1.6.3-1.amzn2.src.rpm
$ rpmdev-extract amazon-linux-extras-1.7.3-1.amzn2.src.rpm
amazon-linux-extras-1.6.3-1.amzn2.src/amazon-linux-extras-1.6.3.tar.xz
amazon-linux-extras-1.6.3-1.amzn2.src/amazon-linux-extras.spec
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Inspecting source RPMs
$ sudo yum install -y yum-utils rpmdevtools
$ yumdownloader --source amazon-linux-extras
amazon-linux-extras-1.6.3-1.amzn2.src.rpm
$ rpmdev-extract amazon-linux-extras-1.7.3-1.amzn2.src.rpm
amazon-linux-extras-1.6.3-1.amzn2.src/amazon-linux-extras-1.6.3.tar.xz
amazon-linux-extras-1.6.3-1.amzn2.src/amazon-linux-extras.spec
Download a specific version:
$ yum list --show-duplicates amazon-linux-extras
$ yumdownloader --source amazon-linux-extras-1.6.2-1.amzn2
Compare two extracted source RPMs:
$ git diff --no-index old new # or your favorite diff tool of choice
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
Lifecycle of a Linux distribution
Inspecting Amazon Linux source RPMs
Safely pushing Amazon Linux repositories
Building Linux container images and AMIs
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Anatomy of a Yum repository
• Optional mirror list: Refers Yum to a list of base URLs
• The base URL: Metadata and packages are prefixed with this URL
• repodata/repomd.xml: lists all metadata
• primary & primary_db: lists all packages
• filelists & filelists_db, other & other_db
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Anatomy of a Yum repository
• Optional mirror list: Refers Yum to a list of base URLs
• The base URL: Metadata and packages are prefixed with this URL
• repodata/repomd.xml: lists all metadata
• primary & primary_db: lists all packages
• filelists & filelists_db, other & other_db
• Yum repositories are just HTTP objects
• Amazon Linux repositories need to be in every region
• Hello, S3!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Repository consistency
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Repository consistency
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Repository consistency
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Repository consistency
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Repository consistency
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Repository consistency
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Tracing Yum’s steps
mirrorlist=http://amazonlinux.us-west-1.amazonaws.com/$releasever/$basearch/mirror.list
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Tracing Yum’s steps
mirrorlist=http://amazonlinux.us-west-1.amazonaws.com/$releasever/$basearch/mirror.list
$ curl http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/mirror.list
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Tracing Yum’s steps
mirrorlist=http://amazonlinux.us-west-1.amazonaws.com/$releasever/$basearch/mirror.list
$ curl http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/mirror.list
http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/e3b0c44298
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Tracing Yum’s steps
mirrorlist=http://amazonlinux.us-west-1.amazonaws.com/$releasever/$basearch/mirror.list
$ curl http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/mirror.list
http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/e3b0c44298
$ curl http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/e3b0c44298/repodata/repomd.xml
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Tracing Yum’s steps
mirrorlist=http://amazonlinux.us-west-1.amazonaws.com/$releasever/$basearch/mirror.list
$ curl http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/mirror.list
http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/e3b0c44298
$ curl http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/e3b0c4429c/repodata/repomd.xml
<repomd xmlns="…">
<revision>1540504372</revision>
<data type="primary_db">
<checksum type="sha256">5622fe…</checksum>
<open-checksum type="sha256">a35e20…</open-checksum>
<location href="repodata/primary.sqlite.gz" />
<size>23412311</size>
</data>
…
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Efficient deployments
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Efficient deployments
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Agenda
Lifecycle of a Linux distribution
Inspecting Amazon Linux source RPMs
Safely pushing Amazon Linux repositories
Building Linux container images and AMIs
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build a container image
1 IMAGE="amzn2-container-raw-2.0.$(date -u +%Y%m%d)-$(uname -p).tar.xz"
2 ROOT=$(mktemp -d)
3 yum --installroot=$ROOT --releasever=2 groupinstall -y container
4 rm -rf $ROOT/var/cache/yum/*
5 (cd $ROOT; tar -cJvf $OLDPWD/$IMAGE .)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build a container image
1 IMAGE="amzn2-container-raw-2.0.$(date -u +%Y%m%d)-$(uname -p).tar.xz"
2 ROOT=$(mktemp -d)
3 yum --installroot=$ROOT --releasever=2 groupinstall -y container
4 rm -rf $ROOT/var/cache/yum/*
5 (cd $ROOT; tar -cJvf $OLDPWD/$IMAGE .)
20180501 x86_64
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build a container image
1 IMAGE="amzn2-container-raw-2.0.$(date -u +%Y%m%d)-$(uname -p).tar.xz"
2 ROOT=$(mktemp -d)
3 yum --installroot=$ROOT --releasever=2 groupinstall -y container
4 rm -rf $ROOT/var/cache/yum/*
5 (cd $ROOT; tar -cJvf $OLDPWD/$IMAGE .)
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build a container image
1 IMAGE="amzn2-container-raw-2.0.$(date -u +%Y%m%d)-$(uname -p).tar.xz"
2 ROOT=$(mktemp -d)
3 yum --installroot=$ROOT --releasever=2 groupinstall -y container
4 rm -rf $ROOT/var/cache/yum/*
5 (cd $ROOT; tar -cJvf $OLDPWD/$IMAGE .)
./
./bin
./boot/
./dev/
./dev/null
./etc/
./etc/aliases
[...]
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2
3
4
5 ROOT=$(mktemp -d)
6
7
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9
10
11
12
13
14 rm -rf $ROOT/var/cache/yum/*
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2
3 # Make a GPT partition table with an XFS partition
4
5 ROOT=$(mktemp -d)
6
7
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9
10
11
12
13
14 rm -rf $ROOT/var/cache/yum/*
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2
3 # Make a GPT partition table with an XFS partition
4
5 ROOT=$(mktemp -d)
6 # Mount the XFS partition at $ROOT
7
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9
10
11
12
13
14 rm -rf $ROOT/var/cache/yum/*
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2
3 # Make a GPT partition table with an XFS partition
4
5 ROOT=$(mktemp -d)
6 # Mount the XFS partition at $ROOT
7
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9
10
11
12
13
14 rm -rf $ROOT/var/cache/yum/* # then unmount everything
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2
3 # Make a GPT partition table with an XFS partition
4
5 ROOT=$(mktemp -d)
6 # Mount the XFS partition at $ROOT
7
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9
10
11 # Install a boot loader
12
13
14 rm -rf $ROOT/var/cache/yum/* # then unmount everything
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4
5 ROOT=$(mktemp -d)
6 # Mount the XFS partition at $ROOT
7
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9
10
11 # Install a boot loader
12
13
14 rm -rf $ROOT/var/cache/yum/* # then unmount everything
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
# gdisk $IMAGE
Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-4194270, default = 2048) or {+-}size{KMGTP}: 4096
Last sector (4096-4194270, default = 4194270) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 8300
Changed type of partition to 'Linux filesystem'
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
# gdisk $IMAGE
Command (? for help): n
Partition number (2-128, default 2): 128
First sector (34-4095, default = 2048) or {+-}size{KMGTP}: 2048
Last sector (2048-4095, default = 4095) or {+-}size{KMGTP}: 4095
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): ef02
Changed type of partition to 'BIOS boot partition'
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 # Make an XFS partition
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 # Make an XFS partition
KPARTX(8) Linux Administrator's Manual
NAME
kpartx - Create device maps from partition tables
EXAMPLE
To mount all the partitions in a raw disk image:
kpartx -av disk.img
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 # Make an XFS partition
KPARTX(8) Linux Administrator's Manual
EXAMPLE
This will output lines such as:
add map loop0p1 (253:0): 0 4190175 linear /dev/loop0 4096
The loop0p1 is the name of a device file under /dev/mapper which you can use
to access the partition, for example to fsck it:
fsck /dev/mapper/loop0p1
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 kpartx -avs $IMAGE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }')
5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT
6
7
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9
10
11 # Install a boot loader
12
13
14 rm -rf $ROOT/var/cache/yum/*; umount $ROOT; kpartx -ds $IMAGE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }')
5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT
6
7
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9
10
11 # Install a boot loader
12
13
14 rm -rf $ROOT/var/cache/yum/*; umount $ROOT; kpartx -ds $IMAGE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }')
5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT
6
7
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9
10
11
12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV)
13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg
14 rm -rf $ROOT/var/cache/yum/*; umount $ROOT; kpartx -ds $IMAGE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }')
5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT
6
7
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9
10
11
12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV)
13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg
14 rm -rf $ROOT/var/cache/yum/*; umount $ROOT; kpartx -ds $IMAGE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }')
5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT
6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 
7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9
10
11
12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV)
13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg
14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }')
5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT
6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 
7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9
10
11
12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV)
13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg
14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }')
5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT
6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 
7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9 # Write /etc/fstab
10 # Copy required configuration files
11
12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV)
13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg
14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 UUID=$(uuidgen); truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }')
5 mkfs.xfs -m uuid=$UUID $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT
6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 
7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9 echo "UUID=$UUID / xfs defaults,noatime 1 1" > $ROOT/etc/fstab
10 # Copy required configuration files
11
12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV)
13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg
14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 UUID=$(uuidgen); truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }')
5 mkfs.xfs -m uuid=$UUID $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT
6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 
7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9 echo "UUID=$UUID / xfs defaults,noatime 1 1" > $ROOT/etc/fstab
10 # Copy required configuration files
11
12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV)
13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg
14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 UUID=$(uuidgen); truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }')
5 mkfs.xfs -m uuid=$UUID $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT
6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 
7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9 echo "UUID=$UUID / xfs defaults,noatime 1 1" > $ROOT/etc/fstab
10 for f in /etc/sysconfig/network /etc/sysconfig/network-scripts/{ifcfg,route}-eth0 
11 /etc/default/grub /etc/selinux/config; do cp -f $f $ROOT$f; done
12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV)
13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg
14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Let’s build an AMI
1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt"
2 UUID=$(uuidgen); truncate -s 2G $IMAGE
3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE
4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }')
5 mkfs.xfs -m uuid=$UUID $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT
6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 
7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys
8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal
9 echo "UUID=$UUID / xfs defaults,noatime 1 1" > $ROOT/etc/fstab
10 for f in /etc/sysconfig/network /etc/sysconfig/network-scripts/{ifcfg,route}-eth0 
11 /etc/default/grub /etc/selinux/config; do cp -f $f $ROOT$f; done
12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV)
13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg
14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
Online resources
https://iweller.people.a2z.com/con404/
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
A brief note before we finish—
• Session surveys provide valuable information to speakers
• Feedback that is very helpful:
• Topics you were excited to learn about
• Suggestions for improving understanding and clarity
• Feedback that is extremely unhelpful:
• Comments unrelated to talk content (please refer to the AWS re:Invent Code of Conduct)
• The “hallway track” is always open!
• Feedback and questions welcome (iweller@amazon.com)
• For support, use the AWS Forums or contact AWS Support
Thank you!
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.
iliana weller (she/her)
iweller@amazon.com
@ilianaweller
© 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.

More Related Content

What's hot

Adding the Sec to Your DevOps Pipelines (SEC332-R1) - AWS re:Invent 2018
Adding the Sec to Your DevOps Pipelines (SEC332-R1) - AWS re:Invent 2018Adding the Sec to Your DevOps Pipelines (SEC332-R1) - AWS re:Invent 2018
Adding the Sec to Your DevOps Pipelines (SEC332-R1) - AWS re:Invent 2018Amazon Web Services
 
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018Amazon Web Services
 
Advanced Continuous Delivery Best Practices (DEV317-R1) - AWS re:Invent 2018
Advanced Continuous Delivery Best Practices (DEV317-R1) - AWS re:Invent 2018Advanced Continuous Delivery Best Practices (DEV317-R1) - AWS re:Invent 2018
Advanced Continuous Delivery Best Practices (DEV317-R1) - AWS re:Invent 2018Amazon Web Services
 
How a Major Australian University Brought Backup to the Cloud
 How a Major Australian University Brought Backup to the Cloud How a Major Australian University Brought Backup to the Cloud
How a Major Australian University Brought Backup to the CloudAmazon Web Services
 
Kubernetes Clusters Security with Amazon EKS (CON338-R1) - AWS re:Invent 2018
Kubernetes Clusters Security with Amazon EKS (CON338-R1) - AWS re:Invent 2018Kubernetes Clusters Security with Amazon EKS (CON338-R1) - AWS re:Invent 2018
Kubernetes Clusters Security with Amazon EKS (CON338-R1) - AWS re:Invent 2018Amazon Web Services
 
Autonomous DevSecOps: Five Steps to a Self-Driving Cloud (ENT214-S) - AWS re:...
Autonomous DevSecOps: Five Steps to a Self-Driving Cloud (ENT214-S) - AWS re:...Autonomous DevSecOps: Five Steps to a Self-Driving Cloud (ENT214-S) - AWS re:...
Autonomous DevSecOps: Five Steps to a Self-Driving Cloud (ENT214-S) - AWS re:...Amazon Web Services
 
Control for Your Cloud Environment Using AWS Management Tools (ENT226-R1) - A...
Control for Your Cloud Environment Using AWS Management Tools (ENT226-R1) - A...Control for Your Cloud Environment Using AWS Management Tools (ENT226-R1) - A...
Control for Your Cloud Environment Using AWS Management Tools (ENT226-R1) - A...Amazon Web Services
 
Infrastructure as Code: AWS Best Practices (DEV411-R3) - AWS re:Invent 2018
Infrastructure as Code: AWS Best Practices (DEV411-R3) - AWS re:Invent 2018Infrastructure as Code: AWS Best Practices (DEV411-R3) - AWS re:Invent 2018
Infrastructure as Code: AWS Best Practices (DEV411-R3) - AWS re:Invent 2018Amazon Web Services
 
A Serverless Journey: AWS Lambda Under the Hood (SRV409-R1) - AWS re:Invent 2018
A Serverless Journey: AWS Lambda Under the Hood (SRV409-R1) - AWS re:Invent 2018A Serverless Journey: AWS Lambda Under the Hood (SRV409-R1) - AWS re:Invent 2018
A Serverless Journey: AWS Lambda Under the Hood (SRV409-R1) - AWS re:Invent 2018Amazon Web Services
 
[NEW LAUNCH!] Lambda Layers (SRV375) - AWS re:Invent 2018
[NEW LAUNCH!] Lambda Layers (SRV375) - AWS re:Invent 2018[NEW LAUNCH!] Lambda Layers (SRV375) - AWS re:Invent 2018
[NEW LAUNCH!] Lambda Layers (SRV375) - AWS re:Invent 2018Amazon Web Services
 
[NEW LAUNCH!] How-to: Amazon RDS on VMware and Hybrid Database Architecture (...
[NEW LAUNCH!] How-to: Amazon RDS on VMware and Hybrid Database Architecture (...[NEW LAUNCH!] How-to: Amazon RDS on VMware and Hybrid Database Architecture (...
[NEW LAUNCH!] How-to: Amazon RDS on VMware and Hybrid Database Architecture (...Amazon Web Services
 
Container Power Hour with Jess, Clare, and Abby (CON362) - AWS re:Invent 2018
Container Power Hour with Jess, Clare, and Abby (CON362) - AWS re:Invent 2018Container Power Hour with Jess, Clare, and Abby (CON362) - AWS re:Invent 2018
Container Power Hour with Jess, Clare, and Abby (CON362) - AWS re:Invent 2018Amazon Web Services
 
Thomson Reuters Shows How It Hosted a .NET App on Amazon ECS Using Windows Co...
Thomson Reuters Shows How It Hosted a .NET App on Amazon ECS Using Windows Co...Thomson Reuters Shows How It Hosted a .NET App on Amazon ECS Using Windows Co...
Thomson Reuters Shows How It Hosted a .NET App on Amazon ECS Using Windows Co...Amazon Web Services
 
Running Kubernetes Across Multiple AWS Accounts (CON409) - AWS re:Invent 2018
Running Kubernetes Across Multiple AWS Accounts (CON409) - AWS re:Invent 2018Running Kubernetes Across Multiple AWS Accounts (CON409) - AWS re:Invent 2018
Running Kubernetes Across Multiple AWS Accounts (CON409) - AWS re:Invent 2018Amazon Web Services
 
Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018
Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018
Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018Amazon Web Services
 
Customizing Content Delivery with Lambda@Edge (CTD415-R1) - AWS re:Invent 2018
Customizing Content Delivery with Lambda@Edge (CTD415-R1) - AWS re:Invent 2018Customizing Content Delivery with Lambda@Edge (CTD415-R1) - AWS re:Invent 2018
Customizing Content Delivery with Lambda@Edge (CTD415-R1) - AWS re:Invent 2018Amazon Web Services
 
How Dow Jones Uses AWS to Enable Innovation and New Engineering Work (CTD316)...
How Dow Jones Uses AWS to Enable Innovation and New Engineering Work (CTD316)...How Dow Jones Uses AWS to Enable Innovation and New Engineering Work (CTD316)...
How Dow Jones Uses AWS to Enable Innovation and New Engineering Work (CTD316)...Amazon Web Services
 
Building the Technical Foundation for Your Security Practice (GPSCT205) - AWS...
Building the Technical Foundation for Your Security Practice (GPSCT205) - AWS...Building the Technical Foundation for Your Security Practice (GPSCT205) - AWS...
Building the Technical Foundation for Your Security Practice (GPSCT205) - AWS...Amazon Web Services
 
Deploy and Scale a Cloud Application with Amazon Lightsail (CMP410-R2) - AWS ...
Deploy and Scale a Cloud Application with Amazon Lightsail (CMP410-R2) - AWS ...Deploy and Scale a Cloud Application with Amazon Lightsail (CMP410-R2) - AWS ...
Deploy and Scale a Cloud Application with Amazon Lightsail (CMP410-R2) - AWS ...Amazon Web Services
 

What's hot (20)

Adding the Sec to Your DevOps Pipelines (SEC332-R1) - AWS re:Invent 2018
Adding the Sec to Your DevOps Pipelines (SEC332-R1) - AWS re:Invent 2018Adding the Sec to Your DevOps Pipelines (SEC332-R1) - AWS re:Invent 2018
Adding the Sec to Your DevOps Pipelines (SEC332-R1) - AWS re:Invent 2018
 
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
Deploying Microservices using AWS Fargate (CON315-R1) - AWS re:Invent 2018
 
Advanced Continuous Delivery Best Practices (DEV317-R1) - AWS re:Invent 2018
Advanced Continuous Delivery Best Practices (DEV317-R1) - AWS re:Invent 2018Advanced Continuous Delivery Best Practices (DEV317-R1) - AWS re:Invent 2018
Advanced Continuous Delivery Best Practices (DEV317-R1) - AWS re:Invent 2018
 
How a Major Australian University Brought Backup to the Cloud
 How a Major Australian University Brought Backup to the Cloud How a Major Australian University Brought Backup to the Cloud
How a Major Australian University Brought Backup to the Cloud
 
Kubernetes Clusters Security with Amazon EKS (CON338-R1) - AWS re:Invent 2018
Kubernetes Clusters Security with Amazon EKS (CON338-R1) - AWS re:Invent 2018Kubernetes Clusters Security with Amazon EKS (CON338-R1) - AWS re:Invent 2018
Kubernetes Clusters Security with Amazon EKS (CON338-R1) - AWS re:Invent 2018
 
Autonomous DevSecOps: Five Steps to a Self-Driving Cloud (ENT214-S) - AWS re:...
Autonomous DevSecOps: Five Steps to a Self-Driving Cloud (ENT214-S) - AWS re:...Autonomous DevSecOps: Five Steps to a Self-Driving Cloud (ENT214-S) - AWS re:...
Autonomous DevSecOps: Five Steps to a Self-Driving Cloud (ENT214-S) - AWS re:...
 
Control for Your Cloud Environment Using AWS Management Tools (ENT226-R1) - A...
Control for Your Cloud Environment Using AWS Management Tools (ENT226-R1) - A...Control for Your Cloud Environment Using AWS Management Tools (ENT226-R1) - A...
Control for Your Cloud Environment Using AWS Management Tools (ENT226-R1) - A...
 
Infrastructure as Code: AWS Best Practices (DEV411-R3) - AWS re:Invent 2018
Infrastructure as Code: AWS Best Practices (DEV411-R3) - AWS re:Invent 2018Infrastructure as Code: AWS Best Practices (DEV411-R3) - AWS re:Invent 2018
Infrastructure as Code: AWS Best Practices (DEV411-R3) - AWS re:Invent 2018
 
A Serverless Journey: AWS Lambda Under the Hood (SRV409-R1) - AWS re:Invent 2018
A Serverless Journey: AWS Lambda Under the Hood (SRV409-R1) - AWS re:Invent 2018A Serverless Journey: AWS Lambda Under the Hood (SRV409-R1) - AWS re:Invent 2018
A Serverless Journey: AWS Lambda Under the Hood (SRV409-R1) - AWS re:Invent 2018
 
[NEW LAUNCH!] Lambda Layers (SRV375) - AWS re:Invent 2018
[NEW LAUNCH!] Lambda Layers (SRV375) - AWS re:Invent 2018[NEW LAUNCH!] Lambda Layers (SRV375) - AWS re:Invent 2018
[NEW LAUNCH!] Lambda Layers (SRV375) - AWS re:Invent 2018
 
[NEW LAUNCH!] How-to: Amazon RDS on VMware and Hybrid Database Architecture (...
[NEW LAUNCH!] How-to: Amazon RDS on VMware and Hybrid Database Architecture (...[NEW LAUNCH!] How-to: Amazon RDS on VMware and Hybrid Database Architecture (...
[NEW LAUNCH!] How-to: Amazon RDS on VMware and Hybrid Database Architecture (...
 
Container Power Hour with Jess, Clare, and Abby (CON362) - AWS re:Invent 2018
Container Power Hour with Jess, Clare, and Abby (CON362) - AWS re:Invent 2018Container Power Hour with Jess, Clare, and Abby (CON362) - AWS re:Invent 2018
Container Power Hour with Jess, Clare, and Abby (CON362) - AWS re:Invent 2018
 
Thomson Reuters Shows How It Hosted a .NET App on Amazon ECS Using Windows Co...
Thomson Reuters Shows How It Hosted a .NET App on Amazon ECS Using Windows Co...Thomson Reuters Shows How It Hosted a .NET App on Amazon ECS Using Windows Co...
Thomson Reuters Shows How It Hosted a .NET App on Amazon ECS Using Windows Co...
 
Running Kubernetes Across Multiple AWS Accounts (CON409) - AWS re:Invent 2018
Running Kubernetes Across Multiple AWS Accounts (CON409) - AWS re:Invent 2018Running Kubernetes Across Multiple AWS Accounts (CON409) - AWS re:Invent 2018
Running Kubernetes Across Multiple AWS Accounts (CON409) - AWS re:Invent 2018
 
Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018
Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018
Build AWS CloudFormation Custom Resources (DEV417-R2) - AWS re:Invent 2018
 
Container Scheduling
Container SchedulingContainer Scheduling
Container Scheduling
 
Customizing Content Delivery with Lambda@Edge (CTD415-R1) - AWS re:Invent 2018
Customizing Content Delivery with Lambda@Edge (CTD415-R1) - AWS re:Invent 2018Customizing Content Delivery with Lambda@Edge (CTD415-R1) - AWS re:Invent 2018
Customizing Content Delivery with Lambda@Edge (CTD415-R1) - AWS re:Invent 2018
 
How Dow Jones Uses AWS to Enable Innovation and New Engineering Work (CTD316)...
How Dow Jones Uses AWS to Enable Innovation and New Engineering Work (CTD316)...How Dow Jones Uses AWS to Enable Innovation and New Engineering Work (CTD316)...
How Dow Jones Uses AWS to Enable Innovation and New Engineering Work (CTD316)...
 
Building the Technical Foundation for Your Security Practice (GPSCT205) - AWS...
Building the Technical Foundation for Your Security Practice (GPSCT205) - AWS...Building the Technical Foundation for Your Security Practice (GPSCT205) - AWS...
Building the Technical Foundation for Your Security Practice (GPSCT205) - AWS...
 
Deploy and Scale a Cloud Application with Amazon Lightsail (CMP410-R2) - AWS ...
Deploy and Scale a Cloud Application with Amazon Lightsail (CMP410-R2) - AWS ...Deploy and Scale a Cloud Application with Amazon Lightsail (CMP410-R2) - AWS ...
Deploy and Scale a Cloud Application with Amazon Lightsail (CMP410-R2) - AWS ...
 

Similar to Care and Feeding of Amazon Linux (CON404-R1) - AWS re:Invent 2018

PHPアプリケーションのコンテナ化入門
PHPアプリケーションのコンテナ化入門PHPアプリケーションのコンテナ化入門
PHPアプリケーションのコンテナ化入門Amazon Web Services Japan
 
Mastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv SummitMastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv SummitArun Gupta
 
Advanced Container Automation, Security, and Monitoring - AWS Summit Sydney 2018
Advanced Container Automation, Security, and Monitoring - AWS Summit Sydney 2018Advanced Container Automation, Security, and Monitoring - AWS Summit Sydney 2018
Advanced Container Automation, Security, and Monitoring - AWS Summit Sydney 2018Amazon Web Services
 
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...Amazon Web Services Korea
 
From Code to a Running Container | AWS Floor28
From Code to a Running Container | AWS Floor28From Code to a Running Container | AWS Floor28
From Code to a Running Container | AWS Floor28Amazon Web Services
 
20190306 AWS Black Belt Online Seminar Amazon EC2 スポットインスタンス
20190306 AWS Black Belt Online Seminar Amazon EC2 スポットインスタンス20190306 AWS Black Belt Online Seminar Amazon EC2 スポットインスタンス
20190306 AWS Black Belt Online Seminar Amazon EC2 スポットインスタンスAmazon Web Services Japan
 
Deploy Serverless Apps with Python: AWS Chalice Deep Dive (DEV427-R2) - AWS r...
Deploy Serverless Apps with Python: AWS Chalice Deep Dive (DEV427-R2) - AWS r...Deploy Serverless Apps with Python: AWS Chalice Deep Dive (DEV427-R2) - AWS r...
Deploy Serverless Apps with Python: AWS Chalice Deep Dive (DEV427-R2) - AWS r...Amazon Web Services
 
Amazon SageMaker 推論エンドポイントを利用したアプリケーション開発
Amazon SageMaker 推論エンドポイントを利用したアプリケーション開発Amazon SageMaker 推論エンドポイントを利用したアプリケーション開発
Amazon SageMaker 推論エンドポイントを利用したアプリケーション開発Amazon Web Services Japan
 
SageMaker로 강화학습(RL) 마스터링 :: 남궁선 - AWS Community Day 2019
SageMaker로 강화학습(RL) 마스터링 :: 남궁선 - AWS Community Day 2019SageMaker로 강화학습(RL) 마스터링 :: 남궁선 - AWS Community Day 2019
SageMaker로 강화학습(RL) 마스터링 :: 남궁선 - AWS Community Day 2019AWSKRUG - AWS한국사용자모임
 
Building Secure Services using Containers
Building Secure Services using ContainersBuilding Secure Services using Containers
Building Secure Services using ContainersAmazon Web Services
 
Runtime Security across Kubernetes and AWS Fargate (CON317-R1) - AWS re:Inven...
Runtime Security across Kubernetes and AWS Fargate (CON317-R1) - AWS re:Inven...Runtime Security across Kubernetes and AWS Fargate (CON317-R1) - AWS re:Inven...
Runtime Security across Kubernetes and AWS Fargate (CON317-R1) - AWS re:Inven...Amazon Web Services
 
Ruby Support for AWS Lambda at Native Speed with Jets
Ruby Support for AWS Lambda at Native Speed with JetsRuby Support for AWS Lambda at Native Speed with Jets
Ruby Support for AWS Lambda at Native Speed with JetsTung Nguyen
 
Capacity Management Made Easy with Amazon EC2 Auto Scaling (CMP377) - AWS re:...
Capacity Management Made Easy with Amazon EC2 Auto Scaling (CMP377) - AWS re:...Capacity Management Made Easy with Amazon EC2 Auto Scaling (CMP377) - AWS re:...
Capacity Management Made Easy with Amazon EC2 Auto Scaling (CMP377) - AWS re:...Amazon Web Services
 
AWS re:Invent 2018
AWS re:Invent 2018 AWS re:Invent 2018
AWS re:Invent 2018 Casey Lee
 
AWS Summit Stockholm - Fargate: deploy containers, not infrastructure
AWS Summit Stockholm - Fargate: deploy containers, not infrastructureAWS Summit Stockholm - Fargate: deploy containers, not infrastructure
AWS Summit Stockholm - Fargate: deploy containers, not infrastructureMassimo Ferre'
 
Introduction To Containers - Builders Day Israel
Introduction To Containers - Builders Day IsraelIntroduction To Containers - Builders Day Israel
Introduction To Containers - Builders Day IsraelAmazon Web Services
 
Microservices for Startups - Donnie Prakoso - AWS - CC18
Microservices for Startups - Donnie Prakoso - AWS - CC18Microservices for Startups - Donnie Prakoso - AWS - CC18
Microservices for Startups - Donnie Prakoso - AWS - CC18CodeOps Technologies LLP
 
Best Practices for Building Multi-Region, Active-Active Serverless Applicatio...
Best Practices for Building Multi-Region, Active-Active Serverless Applicatio...Best Practices for Building Multi-Region, Active-Active Serverless Applicatio...
Best Practices for Building Multi-Region, Active-Active Serverless Applicatio...Amazon Web Services
 
Breaking the monolith (an example)
Breaking the monolith (an example)Breaking the monolith (an example)
Breaking the monolith (an example)Massimo Ferre'
 
Reinventing Amazon EC2 Instance Launches with Launch Templates (CMP369-R1) - ...
Reinventing Amazon EC2 Instance Launches with Launch Templates (CMP369-R1) - ...Reinventing Amazon EC2 Instance Launches with Launch Templates (CMP369-R1) - ...
Reinventing Amazon EC2 Instance Launches with Launch Templates (CMP369-R1) - ...Amazon Web Services
 

Similar to Care and Feeding of Amazon Linux (CON404-R1) - AWS re:Invent 2018 (20)

PHPアプリケーションのコンテナ化入門
PHPアプリケーションのコンテナ化入門PHPアプリケーションのコンテナ化入門
PHPアプリケーションのコンテナ化入門
 
Mastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv SummitMastering Kubernetes on AWS - Tel Aviv Summit
Mastering Kubernetes on AWS - Tel Aviv Summit
 
Advanced Container Automation, Security, and Monitoring - AWS Summit Sydney 2018
Advanced Container Automation, Security, and Monitoring - AWS Summit Sydney 2018Advanced Container Automation, Security, and Monitoring - AWS Summit Sydney 2018
Advanced Container Automation, Security, and Monitoring - AWS Summit Sydney 2018
 
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
AWS System Manager: Parameter Store를 사용한 AWS 구성 데이터 관리 기법 - 정창훈, 당근마켓 / 김대권, ...
 
From Code to a Running Container | AWS Floor28
From Code to a Running Container | AWS Floor28From Code to a Running Container | AWS Floor28
From Code to a Running Container | AWS Floor28
 
20190306 AWS Black Belt Online Seminar Amazon EC2 スポットインスタンス
20190306 AWS Black Belt Online Seminar Amazon EC2 スポットインスタンス20190306 AWS Black Belt Online Seminar Amazon EC2 スポットインスタンス
20190306 AWS Black Belt Online Seminar Amazon EC2 スポットインスタンス
 
Deploy Serverless Apps with Python: AWS Chalice Deep Dive (DEV427-R2) - AWS r...
Deploy Serverless Apps with Python: AWS Chalice Deep Dive (DEV427-R2) - AWS r...Deploy Serverless Apps with Python: AWS Chalice Deep Dive (DEV427-R2) - AWS r...
Deploy Serverless Apps with Python: AWS Chalice Deep Dive (DEV427-R2) - AWS r...
 
Amazon SageMaker 推論エンドポイントを利用したアプリケーション開発
Amazon SageMaker 推論エンドポイントを利用したアプリケーション開発Amazon SageMaker 推論エンドポイントを利用したアプリケーション開発
Amazon SageMaker 推論エンドポイントを利用したアプリケーション開発
 
SageMaker로 강화학습(RL) 마스터링 :: 남궁선 - AWS Community Day 2019
SageMaker로 강화학습(RL) 마스터링 :: 남궁선 - AWS Community Day 2019SageMaker로 강화학습(RL) 마스터링 :: 남궁선 - AWS Community Day 2019
SageMaker로 강화학습(RL) 마스터링 :: 남궁선 - AWS Community Day 2019
 
Building Secure Services using Containers
Building Secure Services using ContainersBuilding Secure Services using Containers
Building Secure Services using Containers
 
Runtime Security across Kubernetes and AWS Fargate (CON317-R1) - AWS re:Inven...
Runtime Security across Kubernetes and AWS Fargate (CON317-R1) - AWS re:Inven...Runtime Security across Kubernetes and AWS Fargate (CON317-R1) - AWS re:Inven...
Runtime Security across Kubernetes and AWS Fargate (CON317-R1) - AWS re:Inven...
 
Ruby Support for AWS Lambda at Native Speed with Jets
Ruby Support for AWS Lambda at Native Speed with JetsRuby Support for AWS Lambda at Native Speed with Jets
Ruby Support for AWS Lambda at Native Speed with Jets
 
Capacity Management Made Easy with Amazon EC2 Auto Scaling (CMP377) - AWS re:...
Capacity Management Made Easy with Amazon EC2 Auto Scaling (CMP377) - AWS re:...Capacity Management Made Easy with Amazon EC2 Auto Scaling (CMP377) - AWS re:...
Capacity Management Made Easy with Amazon EC2 Auto Scaling (CMP377) - AWS re:...
 
AWS re:Invent 2018
AWS re:Invent 2018 AWS re:Invent 2018
AWS re:Invent 2018
 
AWS Summit Stockholm - Fargate: deploy containers, not infrastructure
AWS Summit Stockholm - Fargate: deploy containers, not infrastructureAWS Summit Stockholm - Fargate: deploy containers, not infrastructure
AWS Summit Stockholm - Fargate: deploy containers, not infrastructure
 
Introduction To Containers - Builders Day Israel
Introduction To Containers - Builders Day IsraelIntroduction To Containers - Builders Day Israel
Introduction To Containers - Builders Day Israel
 
Microservices for Startups - Donnie Prakoso - AWS - CC18
Microservices for Startups - Donnie Prakoso - AWS - CC18Microservices for Startups - Donnie Prakoso - AWS - CC18
Microservices for Startups - Donnie Prakoso - AWS - CC18
 
Best Practices for Building Multi-Region, Active-Active Serverless Applicatio...
Best Practices for Building Multi-Region, Active-Active Serverless Applicatio...Best Practices for Building Multi-Region, Active-Active Serverless Applicatio...
Best Practices for Building Multi-Region, Active-Active Serverless Applicatio...
 
Breaking the monolith (an example)
Breaking the monolith (an example)Breaking the monolith (an example)
Breaking the monolith (an example)
 
Reinventing Amazon EC2 Instance Launches with Launch Templates (CMP369-R1) - ...
Reinventing Amazon EC2 Instance Launches with Launch Templates (CMP369-R1) - ...Reinventing Amazon EC2 Instance Launches with Launch Templates (CMP369-R1) - ...
Reinventing Amazon EC2 Instance Launches with Launch Templates (CMP369-R1) - ...
 

More from Amazon Web Services

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Amazon Web Services
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Amazon Web Services
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateAmazon Web Services
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSAmazon Web Services
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Amazon Web Services
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Amazon Web Services
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...Amazon Web Services
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsAmazon Web Services
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareAmazon Web Services
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSAmazon Web Services
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAmazon Web Services
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareAmazon Web Services
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWSAmazon Web Services
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckAmazon Web Services
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without serversAmazon Web Services
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...Amazon Web Services
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceAmazon Web Services
 

More from Amazon Web Services (20)

Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
Come costruire servizi di Forecasting sfruttando algoritmi di ML e deep learn...
 
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
Big Data per le Startup: come creare applicazioni Big Data in modalità Server...
 
Esegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS FargateEsegui pod serverless con Amazon EKS e AWS Fargate
Esegui pod serverless con Amazon EKS e AWS Fargate
 
Costruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWSCostruire Applicazioni Moderne con AWS
Costruire Applicazioni Moderne con AWS
 
Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot Come spendere fino al 90% in meno con i container e le istanze spot
Come spendere fino al 90% in meno con i container e le istanze spot
 
Open banking as a service
Open banking as a serviceOpen banking as a service
Open banking as a service
 
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
Rendi unica l’offerta della tua startup sul mercato con i servizi Machine Lea...
 
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...OpsWorks Configuration Management: automatizza la gestione e i deployment del...
OpsWorks Configuration Management: automatizza la gestione e i deployment del...
 
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows WorkloadsMicrosoft Active Directory su AWS per supportare i tuoi Windows Workloads
Microsoft Active Directory su AWS per supportare i tuoi Windows Workloads
 
Computer Vision con AWS
Computer Vision con AWSComputer Vision con AWS
Computer Vision con AWS
 
Database Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatareDatabase Oracle e VMware Cloud on AWS i miti da sfatare
Database Oracle e VMware Cloud on AWS i miti da sfatare
 
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJSCrea la tua prima serverless ledger-based app con QLDB e NodeJS
Crea la tua prima serverless ledger-based app con QLDB e NodeJS
 
API moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e webAPI moderne real-time per applicazioni mobili e web
API moderne real-time per applicazioni mobili e web
 
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatareDatabase Oracle e VMware Cloud™ on AWS: i miti da sfatare
Database Oracle e VMware Cloud™ on AWS: i miti da sfatare
 
Tools for building your MVP on AWS
Tools for building your MVP on AWSTools for building your MVP on AWS
Tools for building your MVP on AWS
 
How to Build a Winning Pitch Deck
How to Build a Winning Pitch DeckHow to Build a Winning Pitch Deck
How to Build a Winning Pitch Deck
 
Building a web application without servers
Building a web application without serversBuilding a web application without servers
Building a web application without servers
 
Fundraising Essentials
Fundraising EssentialsFundraising Essentials
Fundraising Essentials
 
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
AWS_HK_StartupDay_Building Interactive websites while automating for efficien...
 
Introduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container ServiceIntroduzione a Amazon Elastic Container Service
Introduzione a Amazon Elastic Container Service
 

Care and Feeding of Amazon Linux (CON404-R1) - AWS re:Invent 2018

  • 1.
  • 2. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Care and Feeding of Amazon Linux iliana weller (she/her) Linux Witch Containers and Linux, AWS C O N 4 0 4
  • 3. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. What is Amazon Linux?
  • 4. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. What is Amazon Linux? • Linux operating system, optimized for AWS • AWS feature launches and new Amazon Elastic Compute Cloud (Amazon EC2) instance types from day 1 • Amazon Linux 2 released June 26, 2018 • Amazon Linux AMI (aka Amazon Linux 1) released 2011, EOL 2020 • Universal availability • AMIs for use on Amazon EC2 • Container images • On-premises virtualization images
  • 5. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Agenda Lifecycle of a Linux distribution Inspecting Amazon Linux source RPMs Safely pushing Amazon Linux repositories Building Linux container images and AMIs
  • 6. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Online resources https://iweller.people.a2z.com/con404/
  • 7. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Agenda Lifecycle of a Linux distribution Inspecting Amazon Linux source RPMs Safely pushing Amazon Linux repositories Building Linux container images and AMIs
  • 8. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Lifecycle of a Linux distribution ×
  • 9. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Lifecycle of Amazon Linux
  • 10. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Agenda Lifecycle of a Linux distribution Inspecting Amazon Linux source RPMs Safely pushing Amazon Linux repositories Building Linux container images and AMIs
  • 11. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Inspecting source RPMs $ sudo yum install -y yum-utils rpmdevtools $ yumdownloader --source amazon-linux-extras amazon-linux-extras-1.6.3-1.amzn2.src.rpm $ rpmdev-extract amazon-linux-extras-1.7.3-1.amzn2.src.rpm amazon-linux-extras-1.6.3-1.amzn2.src/amazon-linux-extras-1.6.3.tar.xz amazon-linux-extras-1.6.3-1.amzn2.src/amazon-linux-extras.spec
  • 12. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Inspecting source RPMs $ sudo yum install -y yum-utils rpmdevtools $ yumdownloader --source amazon-linux-extras amazon-linux-extras-1.6.3-1.amzn2.src.rpm $ rpmdev-extract amazon-linux-extras-1.7.3-1.amzn2.src.rpm amazon-linux-extras-1.6.3-1.amzn2.src/amazon-linux-extras-1.6.3.tar.xz amazon-linux-extras-1.6.3-1.amzn2.src/amazon-linux-extras.spec Download a specific version: $ yum list --show-duplicates amazon-linux-extras $ yumdownloader --source amazon-linux-extras-1.6.2-1.amzn2 Compare two extracted source RPMs: $ git diff --no-index old new # or your favorite diff tool of choice
  • 13. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Agenda Lifecycle of a Linux distribution Inspecting Amazon Linux source RPMs Safely pushing Amazon Linux repositories Building Linux container images and AMIs
  • 14. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Anatomy of a Yum repository • Optional mirror list: Refers Yum to a list of base URLs • The base URL: Metadata and packages are prefixed with this URL • repodata/repomd.xml: lists all metadata • primary & primary_db: lists all packages • filelists & filelists_db, other & other_db
  • 15. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Anatomy of a Yum repository • Optional mirror list: Refers Yum to a list of base URLs • The base URL: Metadata and packages are prefixed with this URL • repodata/repomd.xml: lists all metadata • primary & primary_db: lists all packages • filelists & filelists_db, other & other_db • Yum repositories are just HTTP objects • Amazon Linux repositories need to be in every region • Hello, S3!
  • 16. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Repository consistency
  • 17. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Repository consistency
  • 18. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Repository consistency
  • 19. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Repository consistency
  • 20. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Repository consistency
  • 21. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Repository consistency
  • 22. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Tracing Yum’s steps mirrorlist=http://amazonlinux.us-west-1.amazonaws.com/$releasever/$basearch/mirror.list
  • 23. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Tracing Yum’s steps mirrorlist=http://amazonlinux.us-west-1.amazonaws.com/$releasever/$basearch/mirror.list $ curl http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/mirror.list
  • 24. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Tracing Yum’s steps mirrorlist=http://amazonlinux.us-west-1.amazonaws.com/$releasever/$basearch/mirror.list $ curl http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/mirror.list http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/e3b0c44298
  • 25. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Tracing Yum’s steps mirrorlist=http://amazonlinux.us-west-1.amazonaws.com/$releasever/$basearch/mirror.list $ curl http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/mirror.list http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/e3b0c44298 $ curl http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/e3b0c44298/repodata/repomd.xml
  • 26. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Tracing Yum’s steps mirrorlist=http://amazonlinux.us-west-1.amazonaws.com/$releasever/$basearch/mirror.list $ curl http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/mirror.list http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/e3b0c44298 $ curl http://amazonlinux.us-west-1.amazonaws.com/2/x86_64/e3b0c4429c/repodata/repomd.xml <repomd xmlns="…"> <revision>1540504372</revision> <data type="primary_db"> <checksum type="sha256">5622fe…</checksum> <open-checksum type="sha256">a35e20…</open-checksum> <location href="repodata/primary.sqlite.gz" /> <size>23412311</size> </data> …
  • 27. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Efficient deployments
  • 28. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Efficient deployments
  • 29. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Agenda Lifecycle of a Linux distribution Inspecting Amazon Linux source RPMs Safely pushing Amazon Linux repositories Building Linux container images and AMIs
  • 30. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build a container image 1 IMAGE="amzn2-container-raw-2.0.$(date -u +%Y%m%d)-$(uname -p).tar.xz" 2 ROOT=$(mktemp -d) 3 yum --installroot=$ROOT --releasever=2 groupinstall -y container 4 rm -rf $ROOT/var/cache/yum/* 5 (cd $ROOT; tar -cJvf $OLDPWD/$IMAGE .)
  • 31. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build a container image 1 IMAGE="amzn2-container-raw-2.0.$(date -u +%Y%m%d)-$(uname -p).tar.xz" 2 ROOT=$(mktemp -d) 3 yum --installroot=$ROOT --releasever=2 groupinstall -y container 4 rm -rf $ROOT/var/cache/yum/* 5 (cd $ROOT; tar -cJvf $OLDPWD/$IMAGE .) 20180501 x86_64
  • 32. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build a container image 1 IMAGE="amzn2-container-raw-2.0.$(date -u +%Y%m%d)-$(uname -p).tar.xz" 2 ROOT=$(mktemp -d) 3 yum --installroot=$ROOT --releasever=2 groupinstall -y container 4 rm -rf $ROOT/var/cache/yum/* 5 (cd $ROOT; tar -cJvf $OLDPWD/$IMAGE .)
  • 33. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build a container image 1 IMAGE="amzn2-container-raw-2.0.$(date -u +%Y%m%d)-$(uname -p).tar.xz" 2 ROOT=$(mktemp -d) 3 yum --installroot=$ROOT --releasever=2 groupinstall -y container 4 rm -rf $ROOT/var/cache/yum/* 5 (cd $ROOT; tar -cJvf $OLDPWD/$IMAGE .) ./ ./bin ./boot/ ./dev/ ./dev/null ./etc/ ./etc/aliases [...]
  • 34. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 3 4 5 ROOT=$(mktemp -d) 6 7 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 10 11 12 13 14 rm -rf $ROOT/var/cache/yum/*
  • 35. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 3 # Make a GPT partition table with an XFS partition 4 5 ROOT=$(mktemp -d) 6 7 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 10 11 12 13 14 rm -rf $ROOT/var/cache/yum/*
  • 36. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 3 # Make a GPT partition table with an XFS partition 4 5 ROOT=$(mktemp -d) 6 # Mount the XFS partition at $ROOT 7 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 10 11 12 13 14 rm -rf $ROOT/var/cache/yum/*
  • 37. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 3 # Make a GPT partition table with an XFS partition 4 5 ROOT=$(mktemp -d) 6 # Mount the XFS partition at $ROOT 7 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 10 11 12 13 14 rm -rf $ROOT/var/cache/yum/* # then unmount everything
  • 38. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 3 # Make a GPT partition table with an XFS partition 4 5 ROOT=$(mktemp -d) 6 # Mount the XFS partition at $ROOT 7 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 10 11 # Install a boot loader 12 13 14 rm -rf $ROOT/var/cache/yum/* # then unmount everything
  • 39. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 5 ROOT=$(mktemp -d) 6 # Mount the XFS partition at $ROOT 7 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 10 11 # Install a boot loader 12 13 14 rm -rf $ROOT/var/cache/yum/* # then unmount everything
  • 40. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE # gdisk $IMAGE Command (? for help): n Partition number (1-128, default 1): 1 First sector (34-4194270, default = 2048) or {+-}size{KMGTP}: 4096 Last sector (4096-4194270, default = 4194270) or {+-}size{KMGTP}: Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): 8300 Changed type of partition to 'Linux filesystem'
  • 41. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE # gdisk $IMAGE Command (? for help): n Partition number (2-128, default 2): 128 First sector (34-4095, default = 2048) or {+-}size{KMGTP}: 2048 Last sector (2048-4095, default = 4095) or {+-}size{KMGTP}: 4095 Current type is 'Linux filesystem' Hex code or GUID (L to show codes, Enter = 8300): ef02 Changed type of partition to 'BIOS boot partition'
  • 42. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 # Make an XFS partition
  • 43. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 # Make an XFS partition KPARTX(8) Linux Administrator's Manual NAME kpartx - Create device maps from partition tables EXAMPLE To mount all the partitions in a raw disk image: kpartx -av disk.img
  • 44. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 # Make an XFS partition KPARTX(8) Linux Administrator's Manual EXAMPLE This will output lines such as: add map loop0p1 (253:0): 0 4190175 linear /dev/loop0 4096 The loop0p1 is the name of a device file under /dev/mapper which you can use to access the partition, for example to fsck it: fsck /dev/mapper/loop0p1
  • 45. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 kpartx -avs $IMAGE
  • 46. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }') 5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT 6 7 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 10 11 # Install a boot loader 12 13 14 rm -rf $ROOT/var/cache/yum/*; umount $ROOT; kpartx -ds $IMAGE
  • 47. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }') 5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT 6 7 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 10 11 # Install a boot loader 12 13 14 rm -rf $ROOT/var/cache/yum/*; umount $ROOT; kpartx -ds $IMAGE
  • 48. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }') 5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT 6 7 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 10 11 12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV) 13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg 14 rm -rf $ROOT/var/cache/yum/*; umount $ROOT; kpartx -ds $IMAGE
  • 49. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }') 5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT 6 7 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 10 11 12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV) 13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg 14 rm -rf $ROOT/var/cache/yum/*; umount $ROOT; kpartx -ds $IMAGE
  • 50. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }') 5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT 6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 10 11 12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV) 13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg 14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
  • 51. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }') 5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT 6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 10 11 12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV) 13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg 14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
  • 52. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }') 5 mkfs.xfs $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT 6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 # Write /etc/fstab 10 # Copy required configuration files 11 12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV) 13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg 14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
  • 53. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 UUID=$(uuidgen); truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }') 5 mkfs.xfs -m uuid=$UUID $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT 6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 echo "UUID=$UUID / xfs defaults,noatime 1 1" > $ROOT/etc/fstab 10 # Copy required configuration files 11 12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV) 13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg 14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
  • 54. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 UUID=$(uuidgen); truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }') 5 mkfs.xfs -m uuid=$UUID $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT 6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 echo "UUID=$UUID / xfs defaults,noatime 1 1" > $ROOT/etc/fstab 10 # Copy required configuration files 11 12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV) 13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg 14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
  • 55. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 UUID=$(uuidgen); truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }') 5 mkfs.xfs -m uuid=$UUID $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT 6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 echo "UUID=$UUID / xfs defaults,noatime 1 1" > $ROOT/etc/fstab 10 for f in /etc/sysconfig/network /etc/sysconfig/network-scripts/{ifcfg,route}-eth0 11 /etc/default/grub /etc/selinux/config; do cp -f $f $ROOT$f; done 12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV) 13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg 14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
  • 56. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Let’s build an AMI 1 IMAGE="amzn2-ami-minimal-hvm-2.0.$(date -u +%Y%m%d)-$(uname -p).xfs.gpt" 2 UUID=$(uuidgen); truncate -s 2G $IMAGE 3 sgdisk --clear -n 1:4096:0 -t 1:8300 -n 128:2048:4095 -t 128:ef02 $IMAGE 4 DEV=/dev/mapper/$(kpartx -avs $IMAGE | head -n 1 | awk '{ print $3 }') 5 mkfs.xfs -m uuid=$UUID $DEV; ROOT=$(mktemp -d); mount -o discard $DEV $ROOT 6 mkdir $ROOT/{dev,proc,sys}; mount -t devtmpfs devtmpfs $ROOT/dev; 7 mount -t proc proc $ROOT/proc; mount -t sysfs sysfs $ROOT/sys 8 yum --installroot=$ROOT --releasever=2 groupinstall -y ami-minimal 9 echo "UUID=$UUID / xfs defaults,noatime 1 1" > $ROOT/etc/fstab 10 for f in /etc/sysconfig/network /etc/sysconfig/network-scripts/{ifcfg,route}-eth0 11 /etc/default/grub /etc/selinux/config; do cp -f $f $ROOT$f; done 12 chroot $ROOT grub2-install /dev/$(sed -rn 's/^.*(loop[0-9]+).*$/1/p' <<<$DEV) 13 chroot $ROOT grub2-mkconfig -o /boot/grub2/grub.cfg 14 rm -rf $ROOT/var/cache/yum/*; umount --recursive $ROOT; kpartx -ds $IMAGE
  • 57. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. Online resources https://iweller.people.a2z.com/con404/
  • 58. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. A brief note before we finish— • Session surveys provide valuable information to speakers • Feedback that is very helpful: • Topics you were excited to learn about • Suggestions for improving understanding and clarity • Feedback that is extremely unhelpful: • Comments unrelated to talk content (please refer to the AWS re:Invent Code of Conduct) • The “hallway track” is always open! • Feedback and questions welcome (iweller@amazon.com) • For support, use the AWS Forums or contact AWS Support
  • 59. Thank you! © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved. iliana weller (she/her) iweller@amazon.com @ilianaweller
  • 60. © 2018, Amazon Web Services, Inc. or its affiliates. All rights reserved.