Skip to content

Commit

Permalink
Surely
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewpatto committed Sep 1, 2023
1 parent 127d422 commit 4d72fef
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 61 deletions.
37 changes: 1 addition & 36 deletions packages/aws-application/app/elsa-data-application-construct.ts
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ export class ElsaDataApplicationConstruct extends Construct {
): Function {
const entry = path.join(__dirname, "./command-lambda/index.mjs");

const f = new NodejsFunction(this, "api", {
const f = new NodejsFunction(this, "CommandLambda", {
entry: entry,
memorySize: 128,
timeout: Duration.minutes(14),
Expand All @@ -386,41 +386,6 @@ export class ElsaDataApplicationConstruct extends Construct {
},
});

/*const dockerImageFolder = path.join(
__dirname,
"../../../artifacts/elsa-data-command-invoke-lambda-docker-image"
);
// NOTE whilst we use the VPC information to communicate to the lambda
// how to execute fargate Tasks - the lambda itself *is not* put inside the VPC
// (it was taking ages to tear down the CDK stack - and it didn't feel necessary
// as it doesn't talk to the databases or anything)
// this command lambda does almost nothing itself - all it does is trigger the creation of
// a fargate task and then tracks that to completion - and returns the logs path
// so it needs very little memory - but up to 14 mins runtime as sometimes the fargate
// tasks are a bit slow
const f2 = new DockerImageFunction(this, "CommandLambda", {
memorySize: 128,
code: DockerImageCode.fromImageAsset(dockerImageFolder),
timeout: Duration.minutes(14),
environment: {
CLUSTER_ARN: cluster.clusterArn,
CLUSTER_LOG_GROUP_NAME: clusterLogGroup.logGroupName,
TASK_DEFINITION_ARN: taskDefinition.taskDefinitionArn,
CONTAINER_NAME: FIXED_CONTAINER_NAME,
// we are passing to the lambda the subnets and security groups that need to be used
// by the Fargate task it will invoke
SUBNETS: vpc
.selectSubnets(subnetSelection)
.subnets.map((s) => s.subnetId)
.join(",")!,
SECURITY_GROUPS: taskSecurityGroups
.map((sg) => sg.securityGroupId)
.join(",")!,
},
});*/

f.role?.attachInlinePolicy(
new Policy(this, "CommandTasksPolicy", {
statements: [
Expand Down
4 changes: 2 additions & 2 deletions packages/aws-application/elsa-data-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { ElsaDataStackSettings } from "./elsa-data-stack-settings";
import { StringParameter } from "aws-cdk-lib/aws-ssm";
import { Secret } from "aws-cdk-lib/aws-secretsmanager";
import { Bucket } from "aws-cdk-lib/aws-s3";
import { ElsaDataInfrastructureClient } from "@umccr/elsa-data-aws-infrastructure-client";
import { InfrastructureClient } from "@elsa-data/aws-infrastructure-client";

export {
ElsaDataStackSettings,
Expand Down Expand Up @@ -55,7 +55,7 @@ export class ElsaDataStack extends Stack {
return returnLookupValue;
};

const infraClient = new ElsaDataInfrastructureClient(
const infraClient = new InfrastructureClient(
applicationProps.infrastructureStackName
);

Expand Down
2 changes: 2 additions & 0 deletions packages/aws-application/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,13 @@
"constructs": "^10.2.70"
},
"devDependencies": {
"@types/node": "18.15.3",
"aws-cdk": "2.93.0",
"aws-cdk-lib": "2.93.0",
"@aws-cdk/aws-apprunner-alpha": "2.93.0-alpha.0",
"@elsa-data/aws-infrastructure-client": "1.2.3",
"constructs": "10.2.70",
"esbuild": "0.19.2",
"jsii": "5.1.12",
"jsii-pacmak": "1.88.0",
"prettier": "3.0.3",
Expand Down
36 changes: 13 additions & 23 deletions pnpm-lock.yaml

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

0 comments on commit 4d72fef

Please sign in to comment.