🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🪟 Windows TippsSetting up live captions stuck in Windows 11(14.09.2026 um 16:31 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
🪟 Windows TippsWindows 11's latest update broke my speakers, and I'm not alone(14.09.2026 um 18:54 Uhr)
🪟 Windows TippsThe Gemini desktop app is now available for Windows(11.09.2026 um 17:06 Uhr)
🪟 Windows TippsSetting up live captions stuck in Windows 11(14.09.2026 um 16:31 Uhr)
🕵️ SicherheitslückenBurn Out, Or Fade Away(14.09.2026 um 14:25 Uhr)
🪟 Windows TippsWindows 11's latest update broke my speakers, and I'm not alone(14.09.2026 um 18:54 Uhr)

🔧 Programmierung 🕛 vor 1 Jahr 7 Min Lesezeit
0

Deploying SonarQube on AWS EC2 with Cloud Development Kit(CDK): Extending the Database to Amazon RDS PostgreSQL

↗ Quelle (dev.to)
🗣️ Stimme:
📑 Inhaltsübersicht



Day 016 - 100DaysAWSIaCDevopsChallenge


In my previous post,



The infrastructure consists of the following components:





  • VPC and two (02) Subnets(private and public subnet) to manage network traffic within the server and database instance.


  • Internet Gatewayto allow internet communication between our secured cloud environment and external networks.


  • Security group to control access to the server and database based on IP addresses and ports connections.


  • EC2 Instance to host the SonarQube server (including the Web Server, ElasticSearch, and Postgres Database).


  • Key Pair the private key that allows external hosts to connect securely to the instance.


  • Secret Manager to securely store the database user password.


  • IAM Role to allow EC2 Instance to connect to Secret Manager and retrieve database password


  • Elastic IP (EIP) - The static IP to attach to the EC2 Instance. It allows to maintain a fixed IP address aven if the instance is stopped of restarted.


  • Nat Gateway to allow instance (here database instance) in a private subnet to connect to the internet or other AWS Service without exposing then to internet traffic.


  • RDS PostgreSQL the database instance to host the sonarqube data.






Create the database Construct






CODE
interface DatabaseProps extends CustomProps {
vpc: IVpc,
sg?: ISecurityGroup // the security group for SonarQube Server Instance
}
export class Database extends Construct {
private readonly _dbInstanceArn: string
private readonly _passwordSecretArn: string
private readonly _instanceEndpointUrl: string
constructor(scope: Construct, id: string, props: DatabaseProps) {
super(scope, id)
const secret: ISecret = new aws_secretsmanager.Secret(this, 'SecretResource', {
secretName: 'database-instance-secret',
generateSecretString: {
secretStringTemplate: JSON.stringify({ username: props.databaseUsername }),
generateStringKey: 'password',
excludeCharacters: '/@"`()[]\'',
includeSpace: false
}
})
const securityGroup = new SecurityGroup(this, 'DatabaseSecurityGroupeResource', {
securityGroupName: 'sq-database-sg',
disableInlineRules: false,
allowAllOutbound: true,
vpc: props.vpc,
description: 'Database instance security group'
})
securityGroup.addIngressRule(
Peer.securityGroupId(props.sg!.securityGroupId),
Port.tcp(props.databasePort ?? 5432), 'Allow EC2 to connect to the database instance')
const db = new rds.DatabaseInstance(this, 'DatabaseInstanceResource', {
engine: rds.DatabaseInstanceEngine.postgres({
version: rds.PostgresEngineVersion.VER_12_16
}),
vpc: props.vpc,
networkType: rds.NetworkType.IPV4,
vpcSubnets: props.vpc.selectSubnets({ subnetType: SubnetType.PRIVATE_WITH_EGRESS }),
instanceType: InstanceType.of(InstanceClass.BURSTABLE3, InstanceSize.MICRO),
publiclyAccessible: false,
storageType: StorageType.GP3,
credentials: rds.Credentials.fromSecret(secret, props.databaseUsername),
allocatedStorage: 20,
databaseName: props.databaseName,
instanceIdentifier: 'sonarqube-db-1',
port: props.databasePort ?? 5432,
securityGroups: [
securityGroup
]
})
this._dbInstanceArn = db.instanceArn
this._passwordSecretArn = secret.secretArn
this._instanceEndpointUrl = db.instanceEndpoint.socketAddress
}
get dbInstanceArn(): string {
return this._dbInstanceArn
}
get passwordSecretArn() {
return this._passwordSecretArn
}
get instanceEndpointUrl(): string {
return this._instanceEndpointUrl
}
}






The important thing to know here is the snippet code:




CODE
securityGroup.addIngressRule(
Peer.securityGroupId(props.sg!.securityGroupId),
Port.tcp(props.databasePort ?? 5432), 'Allow EC2 to connect to the database instance')






This code allows communication between the database and the EC2 instance server through the specified port.






Update the Stack



This is the update for the stack created in the previous article



Vollständiger Original-Bericht
Ausführliche Details, Code-Beispiele & Hersteller-Stellungnahme auf dev.to.
↗ Original-Artikel auf dev.to lesen
Wie bewertest du diesen Beitrag?
1 Klick Feedback
Teilen mit Netzwerk & Team:

Community-Analysen & Experten-Meinungen 0

Verfasse deine eigene Analyse, teile Workarounds oder diskutiere diesen Vorfall im Blog.
Noch keine Community-Analyse verfasst. Markiere einen Textabschnitt oder klicke oben auf Eigene Analyse verfassen“!
Community Pulse: Relevanz-Einschätzung
1 Klick Experten-Votum
🔴 Akute Relevanz 0%
🟡 In Evaluierung 0%
🟢 Keine Auswirkung 0%
Spannende Innovation 0%
Verwandte Story-Cluster & Quellen (Vektor-KI)
Port 8095 Engine
1 Quelle
Hawley probes OpenAI over Hugging Face breach
1 Quelle
Conti ransomware crew member sentenced to four years in prison
1 Quelle
Researchers say OpenAI agents were behind May hacking campaign targeting RubyGems
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Deploying SonarQube on AWS EC2 with Cloud Development Kit(CDK): Extending the Database to Amazon RDS PostgreSQL

Thematisch verwandte Begriffe: Deploying, SonarQube, with, Cloud · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...