Skip to content

Instantly share code, notes, and snippets.

@jamesdavidson
Created July 12, 2023 08:04
Show Gist options
  • Save jamesdavidson/e6913e3a77318ff8afdf9db651585ad6 to your computer and use it in GitHub Desktop.
Save jamesdavidson/e6913e3a77318ff8afdf9db651585ad6 to your computer and use it in GitHub Desktop.
ec2-boot-bench
# 12th July 2023
# trying out https://www.daemonology.net/blog/2021-08-12-EC2-boot-time-benchmarking.html
cloudshell-user@ip-10-2-80-7 infra]$ history
1 git clone https://github.com/cperciva/ec2-boot-bench
2 cd ~/ec2-boot-bench/
3 ls
4 cat BUILDING
5 ./configure
6 make
7 yum install cc
8 sudo yum install build-essential
9 sudo yum install clang
10 make
11 yum install openssl
12 sudo yum install openssl
13 make
14 sudo yum install openssl-devel
15 make
16 ./ec2-boot-bench/ec2-boot-bench
17 ./ec2-boot-bench/ec2-boot-bench --region ap-southeast-2 --ami ami-04c2e0d1877e39a57 --itype t3.micro --subnet subnet-5bba5313
18 ssh-keygen -t -rsa
19 ssh-keygen -t rsa
20 cat ~/.ssh/id_rsa.pub
21 ./ec2-boot-bench/ec2-boot-bench --keys ~/.ssh/id_rsa --region ap-southeast-2 --ami ami-04c2e0d1877e39a57 --itype t3.micro --subnet subnet-5bba531
22 rm -fv ~/.ssh/id_rsa
23 rm -fv ~/.ssh/id_rsa.pub
24 cd ~/infra
25 mkdir ~/infra
26 cd ~/infra
27 vi config.tf
28 terraform init
29 sudo yum install terraform
30 sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
31 sudo yum install -y yum-utils shadow-utils
32 sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
33 sudo yum install terraform
34 terraform init
35 vi user.tf
36 terraform apply
37 vi user.tf
38 terraform apply
39 terraform output secret
40 cd ~/ec2-boot-bench/
45 vi credentials.txt
46 ./ec2-boot-bench/ec2-boot-bench --keys credentials.txt --region ap-southeast-2 --ami ami-04c2e0d1877e39a57 --itype t3.micro --subnet subnet-5bba531
47 cat credentials.txt
48 mv -v credentials.txt ec2-boot-bench/
49 cd ~/ec2-boot-bench/ec2-boot-bench/
50 ./ec2-boot-bench --keys credentials.txt --region ap-southeast-2 --ami ami-04c2e0d1877e39a57 --itype t3.micro --subnet subnet-5bba531
51 vi credentials.txt
52 ./ec2-boot-bench --keys credentials.txt --region ap-southeast-2 --ami ami-04c2e0d1877e39a57 --itype t3.micro --subnet subnet-5bba531
53 ./ec2-boot-bench --keys credentials.txt --region ap-southeast-2 --ami ami-04c2e0d1877e39a57 --itype t3.micro --subnet subnet-5bba5313
54 ./ec2-boot-bench
55 ./ec2-boot-bench --keys credentials.txt --region ap-southeast-2 --ami ami-04c2e0d1877e39a57 --itype t3.micro --no-ipv6 --security-group sg-5a089b2d --subnet subnet-5bba5313
56 ./ec2-boot-bench
57 ./ec2-boot-bench --keys credentials.txt --region ap-southeast-2 --ami ami-04c2e0d1877e39a57 --itype t3.micro --no-ipv6 --security-group sg-5a089b2d --subnet subnet-5bba5313
58 ./ec2-boot-bench --keys credentials.txt --region ap-southeast-2 --ami ami-04c2e0d1877e39a57 --itype c5.2xlarge --no-ipv6 --security-group sg-5a089b2d --subnet subnet-5bba5313
59 cd ~/infra/
60 ls
61 mv -v user.tf user.tf.backup
62 terraform apply
63 history
[cloudshell-user@ip-10-2-80-7 infra]$ cat config.tf user.tf.backup
terraform {
required_providers {
aws = {
source = "hashicorp/aws"
version = "5.7.0"
}
}
}
provider "aws" {
region = "ap-southeast-2"
}
resource "aws_iam_access_key" "lb" {
user = aws_iam_user.lb.name
}
resource "aws_iam_user" "lb" {
name = "temp-2023-07-12"
}
resource "aws_iam_user_policy" "lb_ro" {
name = "temp-2023-07-12"
user = aws_iam_user.lb.name
policy = <<EOF
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"ec2:*"
],
"Effect": "Allow",
"Resource": "*"
}
]
}
EOF
}
output "secret" {
value = aws_iam_access_key.lb.secret
sensitive = true
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment