Skip to content

Commit

Permalink
update cdk version (#422)
Browse files Browse the repository at this point in the history
  • Loading branch information
statefb authored Jul 2, 2024
1 parent c97387d commit 0d5b12c
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 66 deletions.
23 changes: 10 additions & 13 deletions cdk/custom-resources/setup-pgvector/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Client } = require("pg");
import { getSecret } from "@aws-lambda-powertools/parameters/secrets";
const { getSecret } = require("@aws-lambda-powertools/parameters/secrets");

const setUp = async (dbConfig) => {
const client = new Client(dbConfig);
Expand Down Expand Up @@ -66,23 +66,20 @@ const updateStatus = async (event, status, reason, physicalResourceId) => {
exports.handler = async (event, context) => {
console.log(`Received event: ${JSON.stringify(event, null, 2)}`);
console.log(`Received context: ${JSON.stringify(context, null, 2)}`);

console.log(`DB_SECRETS_ARN: ${process.env.DB_SECRETS_ARN}`);
const secrets = await getSecret(process.env.DB_SECRETS_ARN);
const dbInfo = JSON.parse(secrets);

// const dbConfig = event.ResourceProperties.dbConfig;
const dbConfig = {
host: dbInfo["host"],
user: dbInfo["username"],
password: dbInfo["password"],
database: dbInfo["dbname"],
port: dbInfo["port"],
};

const dbClusterIdentifier = process.env.DB_CLUSTER_IDENTIFIER;

try {
const secrets = await getSecret(process.env.DB_SECRETS_ARN);
const dbInfo = JSON.parse(secrets);
const dbConfig = {
host: dbInfo["host"],
user: dbInfo["username"],
password: dbInfo["password"],
database: dbInfo["dbname"],
port: dbInfo["port"],
};
switch (event.RequestType) {
case "Create":
case "Update":
Expand Down
78 changes: 29 additions & 49 deletions cdk/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions cdk/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@
"@aws-prototyping-sdk/pdk-nag": "^0.19.68",
"@types/jest": "^29.5.3",
"@types/node": "20.4.2",
"aws-cdk": "2.132.0",
"aws-cdk": "2.147.3",
"jest": "^29.6.1",
"ts-jest": "^29.1.1",
"ts-node": "^10.9.1",
"typescript": "~5.1.6"
},
"dependencies": {
"@aws-cdk/aws-glue-alpha": "^2.132.0-alpha.0",
"@aws-cdk/aws-lambda-python-alpha": "^2.132.0-alpha.0",
"aws-cdk-lib": "^2.132.0",
"@aws-cdk/aws-glue-alpha": "^2.147.3-alpha.0",
"@aws-cdk/aws-lambda-python-alpha": "^2.147.3-alpha.0",
"aws-cdk-lib": "^2.147.3",
"cdk-aws-lambda-powertools-layer": "^3.7.0",
"constructs": "^10.0.0",
"deploy-time-build": "^0.3.2",
Expand Down

0 comments on commit 0d5b12c

Please sign in to comment.