github.com/containerd/containerd@v22.0.0-20200918172823-438c87b8e050+incompatible/contrib/aws/snapshotter_bench_cf.yml (about)

     1  AWSTemplateFormatVersion: "2010-09-09"
     2  
     3  Description: >
     4    This templates spin ups an EC2 instance with EBS volumes suitable for containerd snapshotters benchmarking.
     5    The template will create EBS volumes for benchmarking (/dev/sdb, /dev/sdc, and /dev/sdd) with same performance characteristics.
     6    /dev/sde volume will be created and used for device mapper thin-pool device.
     7  
     8  Parameters:
     9    Key:
    10      Type: AWS::EC2::KeyPair::KeyName
    11      Description: SSH key to use
    12  
    13    AMI:
    14      Type: AWS::EC2::Image::Id
    15      Description: AMI ID to use for the EC2 instance. Must be Amazon Linux 2.
    16      Default: "ami-032509850cf9ee54e"
    17  
    18    SecurityGroups:
    19      Type: List<AWS::EC2::SecurityGroup::Id>
    20      Description: List of security groups to add to EC2 instance
    21  
    22    InstanceType:
    23      Type: String
    24      Default: m4.xlarge
    25      Description: EC2 instance type to use
    26  
    27    VolumesIOPS:
    28      Type: Number
    29      Default: 1000
    30      MinValue: 100
    31      MaxValue: 20000
    32      Description: The number of I/O operations per second (IOPS) to reserve for EBS volumes.
    33  
    34    VolumesSize:
    35      Type: Number
    36      Default: 20
    37      MinValue: 4
    38      MaxValue: 16384
    39      Description: EBS volumes size, in gibibytes (GiB)
    40  
    41    VolumeType:
    42      Type: String
    43      Default: io1
    44      AllowedValues:
    45        - io1
    46        - gp2
    47        - sc1
    48        - st1
    49      Description: >
    50        Volume type to use for EBS volumes (io1 is recommended).
    51        More information on volume types https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/EBSVolumeTypes.html
    52  
    53    ContainerStorageSetup:
    54      Type: String
    55      Default: https://github.com/projectatomic/container-storage-setup/archive/v0.6.0.tar.gz
    56      Description: container-storage-setup tool version to install (more details at https://github.com/projectatomic/container-storage-setup)
    57  
    58  Resources:
    59    Instance:
    60      Type: AWS::EC2::Instance
    61      Properties:
    62        EbsOptimized: true
    63        InstanceType: !Ref InstanceType
    64        KeyName: !Ref Key
    65        ImageId: !Ref AMI
    66        SecurityGroupIds: !Ref SecurityGroups
    67        BlockDeviceMappings:
    68          - DeviceName: "/dev/xvda" # Root volume
    69            Ebs:
    70              VolumeSize: 64
    71              VolumeType: io1
    72              Iops: 1000
    73              DeleteOnTermination: true
    74          - DeviceName: "/dev/sdb"
    75            Ebs:
    76              VolumeSize: !Ref VolumesSize
    77              VolumeType: !Ref VolumeType
    78              Iops: !Ref VolumesIOPS
    79              DeleteOnTermination: true
    80          - DeviceName: "/dev/sdc"
    81            Ebs:
    82              VolumeSize: !Ref VolumesSize
    83              VolumeType: !Ref VolumeType
    84              Iops: !Ref VolumesIOPS
    85              DeleteOnTermination: true
    86          - DeviceName: "/dev/sdd"
    87            Ebs:
    88              VolumeSize: !Ref VolumesSize
    89              VolumeType: !Ref VolumeType
    90              Iops: !Ref VolumesIOPS
    91              DeleteOnTermination: true
    92          - DeviceName: "/dev/sde"
    93            Ebs:
    94              VolumeSize: !Ref VolumesSize
    95              VolumeType: !Ref VolumeType
    96              Iops: !Ref VolumesIOPS
    97              DeleteOnTermination: true
    98  
    99        UserData:
   100          Fn::Base64:
   101            !Sub |
   102            #!/bin/bash
   103  
   104            set -ex
   105  
   106            yum install -y \
   107              gcc \
   108              git \
   109              btrfs-progs-devel \
   110              libseccomp-devel
   111  
   112            amazon-linux-extras install -y golang1.11
   113  
   114            # Install container-storage-setup
   115            mkdir -p /tmp/container-storage-setup/unpacked/
   116            cd /tmp/container-storage-setup/
   117            curl -sL ${ContainerStorageSetup} -o archive.tar.gz
   118            tar -xzf archive.tar.gz -C unpacked --strip 1
   119            cd unpacked/
   120            make install-core
   121            rm -rf /tmp/container-storage-setup/
   122  
   123            # Prepare EBS volumes
   124            mkdir -p /mnt/{disk1,disk2,disk3}
   125  
   126            mkfs.ext4 /dev/sdb
   127            mount /dev/sdb /mnt/disk1/
   128  
   129            mkfs.ext4 /dev/sdc
   130            mount /dev/sdc /mnt/disk2/
   131  
   132            mkfs.ext4 /dev/sdd
   133            mount /dev/sdd /mnt/disk3
   134  
   135            chgrp -R wheel /mnt/disk1/ /mnt/disk2/ /mnt/disk3/
   136            chmod -R 2775 /mnt/disk1/ /mnt/disk2/ /mnt/disk3/
   137  
   138            # Prepare thin-pool device
   139            touch /etc/sysconfig/docker-storage-setup
   140            echo DEVS=/dev/sde >> /etc/sysconfig/docker-storage-setup
   141            echo VG=bench >> /etc/sysconfig/docker-storage-setup
   142            container-storage-setup
   143  
   144            echo "Done"