Skip to content

Commit 292e94f

Browse files
authored
fix: upgrade pgbouncer ami to ubuntu 24.04 (#148)
this helps avoid security vulnerabilities for the EC2 instance
1 parent 6438798 commit 292e94f

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

lib/database/PgBouncer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ export class PgBouncer extends Construct {
147147
: ec2.SubnetType.PRIVATE_WITH_EGRESS,
148148
},
149149
machineImage: ec2.MachineImage.fromSsmParameter(
150-
"/aws/service/canonical/ubuntu/server/jammy/stable/current/amd64/hvm/ebs-gp2/ami-id",
150+
"/aws/service/canonical/ubuntu/server/noble/stable/current/amd64/hvm/ebs-gp3/ami-id",
151151
{ os: ec2.OperatingSystemType.LINUX }
152152
),
153153
blockDevices: [

lib/database/pgbouncer-setup.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ curl https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
1919
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
2020

2121
# Install required packages
22-
apt-get update
2322

2423
# Function that makes sure we don't hit a dpkg lock error
2524
wait_for_dpkg_lock() {
@@ -30,7 +29,12 @@ wait_for_dpkg_lock() {
3029
}
3130

3231
wait_for_dpkg_lock
33-
DEBIAN_FRONTEND=noninteractive apt-get install -y pgbouncer jq awscli
32+
export DEBIAN_FRONTEND=noninteractive
33+
34+
apt-get update
35+
apt-get upgrade -y
36+
apt-get install -y pgbouncer jq
37+
snap install aws-cli --classic
3438

3539
echo "Fetching secret from ARN: ${SECRET_ARN}"
3640

0 commit comments

Comments
 (0)