Skip to content

Commit

Permalink
updated code to use vpc id rather than name
Browse files Browse the repository at this point in the history
  • Loading branch information
Trent Cameron committed Oct 21, 2024
1 parent 3935da8 commit 59c9db6
Show file tree
Hide file tree
Showing 2 changed files with 1,613 additions and 1,881 deletions.
10 changes: 9 additions & 1 deletion lib/database-collector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,16 @@ import {Runtime} from "aws-cdk-lib/aws-lambda";
import {Rule} from "aws-cdk-lib/aws-events";
import {LambdaFunction} from "aws-cdk-lib/aws-events-targets";
import {Duration} from "aws-cdk-lib";
import {Vpc} from "aws-cdk-lib/aws-ec2";


export interface DatabaseCollectorProps {
}

export class DatabaseCollector extends Construct {
private prometheusUrl = this.node.tryGetContext('prometheusUrl')
private vpcId = this.node.tryGetContext('vpcId')

private buildAndDeployRDSEventsCollector() {
const role = new Role(this, "Role", {
assumedBy: new ServicePrincipal("lambda.amazonaws.com")
Expand Down Expand Up @@ -59,8 +62,13 @@ export class DatabaseCollector extends Construct {
file: path.join('build', 'Dockerfile'),
platform: Platform.LINUX_ARM64
})
//TODO const fargateVpc = this.node.tryGetContext
const vpc = Vpc.fromLookup(this, 'Vpc', {
vpcId: this.vpcId
});

const cluster = new StandardFargateCluster(this, "Cluster", {
vpcName: "services"
vpc: vpc,
});
const service = new StandardFargateService(this, 'Service', {
image: ContainerImage.fromDockerImageAsset(asset),
Expand Down
Loading

0 comments on commit 59c9db6

Please sign in to comment.