@umccr/htsget-lambda 0.9.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +23 -0
- package/README.md +89 -0
- package/bin/htsget-stack.d.ts +6 -0
- package/bin/htsget-stack.js +59 -0
- package/bin/htsget-stack.ts +31 -0
- package/bin/settings.d.ts +5 -0
- package/bin/settings.js +15 -0
- package/bin/settings.ts +13 -0
- package/cdk.json +29 -0
- package/docs/config/CONFIG.md +101 -0
- package/docs/examples/CROSS_ACCOUNT_SETUP.md +88 -0
- package/index.d.ts +2 -0
- package/index.js +19 -0
- package/index.ts +2 -0
- package/lib/config.d.ts +240 -0
- package/lib/config.js +3 -0
- package/lib/config.ts +270 -0
- package/lib/htsget-lambda.d.ts +36 -0
- package/lib/htsget-lambda.js +363 -0
- package/lib/htsget-lambda.ts +534 -0
- package/package.json +30 -0
- package/tsconfig.json +10 -0
- package/typedoc.json +11 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Permission is hereby granted, free of charge, to any
|
|
2
|
+
person obtaining a copy of this software and associated
|
|
3
|
+
documentation files (the "Software"), to deal in the
|
|
4
|
+
Software without restriction, including without
|
|
5
|
+
limitation the rights to use, copy, modify, merge,
|
|
6
|
+
publish, distribute, sublicense, and/or sell copies of
|
|
7
|
+
the Software, and to permit persons to whom the Software
|
|
8
|
+
is furnished to do so, subject to the following
|
|
9
|
+
conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice
|
|
12
|
+
shall be included in all copies or substantial portions
|
|
13
|
+
of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
|
|
16
|
+
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
|
|
17
|
+
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
|
|
18
|
+
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
|
|
19
|
+
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
20
|
+
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
|
|
22
|
+
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
23
|
+
DEALINGS IN THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
## Quickstart
|
|
2
|
+
|
|
3
|
+
Here's how to deploy [htsget-rs's htsget-lambda](https://github.com/umccr/htsget-rs) to AWS:
|
|
4
|
+
|
|
5
|
+
1. Install packages by running `npm install` or `pnpm install`.
|
|
6
|
+
2. Authenticate to your AWS account (preferably using SSO).
|
|
7
|
+
3. Modify the [`bin/settings.ts`][htsget-settings], according to your preferences. All options are documented at [`docs/CONFIG.md`][docs-config].
|
|
8
|
+
4. Run `npx cdk deploy`.
|
|
9
|
+
|
|
10
|
+
### Does it work?
|
|
11
|
+
|
|
12
|
+
A simple `curl` command should be able to determine that:
|
|
13
|
+
|
|
14
|
+
```sh
|
|
15
|
+
curl "https://htsget.ga4gh-demo.org/reads/service-info"
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Should return a response similar to the following:
|
|
19
|
+
|
|
20
|
+
```json
|
|
21
|
+
{
|
|
22
|
+
"id": "htsget-lambda/0.5.2",
|
|
23
|
+
"createdAt": "2025-01-22T23:29:34.423733522+00:00",
|
|
24
|
+
"name": "htsget-lambda",
|
|
25
|
+
"version": "0.5.2",
|
|
26
|
+
"updatedAt": "2025-01-22T23:29:34.423735886+00:00",
|
|
27
|
+
"description": "A cloud-based instance of htsget-rs using AWS Lambda, which serves data according to the htsget protocol.",
|
|
28
|
+
"organization": {
|
|
29
|
+
"name": "",
|
|
30
|
+
"url": ""
|
|
31
|
+
},
|
|
32
|
+
"documentationUrl": "https://github.com/umccr/htsget-rs",
|
|
33
|
+
"type": {
|
|
34
|
+
"group": "org.ga4gh",
|
|
35
|
+
"artifact": "htsget",
|
|
36
|
+
"version": "1.3.0"
|
|
37
|
+
},
|
|
38
|
+
"htsget": {
|
|
39
|
+
"datatype": "reads",
|
|
40
|
+
"formats": [
|
|
41
|
+
"BAM",
|
|
42
|
+
"CRAM"
|
|
43
|
+
],
|
|
44
|
+
"fieldsParametersEffective": false,
|
|
45
|
+
"tagsParametersEffective": false
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Please note that the example above assumes a publicly accessible endpoint. If you have an authz'd deployment, please add `-H "Authorization: $JWT_TOKEN"` flags to your `curl` command.
|
|
51
|
+
|
|
52
|
+
## Library
|
|
53
|
+
|
|
54
|
+
The `HtsgetConstruct` is [published][htsget-npm] as an NPM package so that it can be used as construct in other projects.
|
|
55
|
+
|
|
56
|
+
## Local development
|
|
57
|
+
|
|
58
|
+
This project uses pnpm as the preferred package manager. To install and update the lock file, run:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
pnpm install
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
To generate the [config docs][docs-config], run:
|
|
65
|
+
|
|
66
|
+
```sh
|
|
67
|
+
npx typedoc
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
[htsget-npm]: https://www.npmjs.com/package/htsget-lambda
|
|
71
|
+
[docs-config]: docs/config/CONFIG.md
|
|
72
|
+
[htsget-settings]: bin/settings.ts
|
|
73
|
+
[cargo-lambda]: https://github.com/cargo-lambda/cargo-lambda
|
|
74
|
+
[htsget-rs]: https://github.com/umccr/htsget-rs
|
|
75
|
+
[aws-cdk]: https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html
|
|
76
|
+
[cdk-context]: https://docs.aws.amazon.com/cdk/v2/guide/context.html
|
|
77
|
+
[cdk-lookup-value]: https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_ssm.StringParameter.html#static-valuewbrfromwbrlookupscope-parametername
|
|
78
|
+
[cdk-json]: cdk.json
|
|
79
|
+
[aws-ssm]: https://docs.aws.amazon.com/systems-manager/latest/userguide/systems-manager-parameter-store.html
|
|
80
|
+
[aws-api-gateway]: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-develop-integrations-lambda.html
|
|
81
|
+
[aws-cognito]: https://docs.aws.amazon.com/cognito/latest/developerguide/cognito-user-identity-pools.html
|
|
82
|
+
[jwt-authorizer]: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-jwt-authorizer.html
|
|
83
|
+
[jwt-audience]: https://docs.aws.amazon.com/apigatewayv2/latest/api-reference/apis-apiid-authorizers-authorizerid.html#apis-apiid-authorizers-authorizerid-model-jwtconfiguration
|
|
84
|
+
[route-53]: https://docs.aws.amazon.com/Route53/latest/DeveloperGuide/Welcome.html
|
|
85
|
+
[rust-function]: https://www.npmjs.com/package/rust.aws-cdk-lambda
|
|
86
|
+
[aws-cdk]: https://docs.aws.amazon.com/cdk/v2/guide/getting_started.html
|
|
87
|
+
[aws-cli]: https://docs.aws.amazon.com/cli/latest/userguide/getting-started-install.html
|
|
88
|
+
[npm]: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
|
|
89
|
+
[rust]: https://www.rust-lang.org/tools/install
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as cdk from "aws-cdk-lib";
|
|
2
|
+
import { Construct } from "constructs";
|
|
3
|
+
import { HtsgetLambdaProps } from "../index";
|
|
4
|
+
export declare class HtsgetStack extends cdk.Stack {
|
|
5
|
+
constructor(scope: Construct, id: string, settings: HtsgetLambdaProps, props?: cdk.StackProps);
|
|
6
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.HtsgetStack = void 0;
|
|
37
|
+
const cdk = __importStar(require("aws-cdk-lib"));
|
|
38
|
+
const settings_1 = require("./settings");
|
|
39
|
+
const htsget_lambda_1 = require("../lib/htsget-lambda");
|
|
40
|
+
class HtsgetStack extends cdk.Stack {
|
|
41
|
+
constructor(scope, id, settings, props) {
|
|
42
|
+
super(scope, id, props);
|
|
43
|
+
new htsget_lambda_1.HtsgetLambda(this, "HtsgetLambda", settings);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
exports.HtsgetStack = HtsgetStack;
|
|
47
|
+
const app = new cdk.App();
|
|
48
|
+
new HtsgetStack(app, "HtsgetLambdaStack", settings_1.SETTINGS, {
|
|
49
|
+
stackName: "HtsgetLambdaStack",
|
|
50
|
+
description: "A stack deploying htsget-rs with API gateway.",
|
|
51
|
+
tags: {
|
|
52
|
+
Stack: "HtsgetLambdaStack",
|
|
53
|
+
},
|
|
54
|
+
env: {
|
|
55
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
56
|
+
region: process.env.CDK_DEFAULT_REGION,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaHRzZ2V0LXN0YWNrLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiaHRzZ2V0LXN0YWNrLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUFBLGlEQUFtQztBQUduQyx5Q0FBc0M7QUFDdEMsd0RBQW9EO0FBRXBELE1BQWEsV0FBWSxTQUFRLEdBQUcsQ0FBQyxLQUFLO0lBQ3hDLFlBQ0UsS0FBZ0IsRUFDaEIsRUFBVSxFQUNWLFFBQTJCLEVBQzNCLEtBQXNCO1FBRXRCLEtBQUssQ0FBQyxLQUFLLEVBQUUsRUFBRSxFQUFFLEtBQUssQ0FBQyxDQUFDO1FBRXhCLElBQUksNEJBQVksQ0FBQyxJQUFJLEVBQUUsY0FBYyxFQUFFLFFBQVEsQ0FBQyxDQUFDO0lBQ25ELENBQUM7Q0FDRjtBQVhELGtDQVdDO0FBRUQsTUFBTSxHQUFHLEdBQUcsSUFBSSxHQUFHLENBQUMsR0FBRyxFQUFFLENBQUM7QUFDMUIsSUFBSSxXQUFXLENBQUMsR0FBRyxFQUFFLG1CQUFtQixFQUFFLG1CQUFRLEVBQUU7SUFDbEQsU0FBUyxFQUFFLG1CQUFtQjtJQUM5QixXQUFXLEVBQUUsK0NBQStDO0lBQzVELElBQUksRUFBRTtRQUNKLEtBQUssRUFBRSxtQkFBbUI7S0FDM0I7SUFDRCxHQUFHLEVBQUU7UUFDSCxPQUFPLEVBQUUsT0FBTyxDQUFDLEdBQUcsQ0FBQyxtQkFBbUI7UUFDeEMsTUFBTSxFQUFFLE9BQU8sQ0FBQyxHQUFHLENBQUMsa0JBQWtCO0tBQ3ZDO0NBQ0YsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiaW1wb3J0ICogYXMgY2RrIGZyb20gXCJhd3MtY2RrLWxpYlwiO1xuaW1wb3J0IHsgQ29uc3RydWN0IH0gZnJvbSBcImNvbnN0cnVjdHNcIjtcbmltcG9ydCB7IEh0c2dldExhbWJkYVByb3BzIH0gZnJvbSBcIi4uL2luZGV4XCI7XG5pbXBvcnQgeyBTRVRUSU5HUyB9IGZyb20gXCIuL3NldHRpbmdzXCI7XG5pbXBvcnQgeyBIdHNnZXRMYW1iZGEgfSBmcm9tIFwiLi4vbGliL2h0c2dldC1sYW1iZGFcIjtcblxuZXhwb3J0IGNsYXNzIEh0c2dldFN0YWNrIGV4dGVuZHMgY2RrLlN0YWNrIHtcbiAgY29uc3RydWN0b3IoXG4gICAgc2NvcGU6IENvbnN0cnVjdCxcbiAgICBpZDogc3RyaW5nLFxuICAgIHNldHRpbmdzOiBIdHNnZXRMYW1iZGFQcm9wcyxcbiAgICBwcm9wcz86IGNkay5TdGFja1Byb3BzLFxuICApIHtcbiAgICBzdXBlcihzY29wZSwgaWQsIHByb3BzKTtcblxuICAgIG5ldyBIdHNnZXRMYW1iZGEodGhpcywgXCJIdHNnZXRMYW1iZGFcIiwgc2V0dGluZ3MpO1xuICB9XG59XG5cbmNvbnN0IGFwcCA9IG5ldyBjZGsuQXBwKCk7XG5uZXcgSHRzZ2V0U3RhY2soYXBwLCBcIkh0c2dldExhbWJkYVN0YWNrXCIsIFNFVFRJTkdTLCB7XG4gIHN0YWNrTmFtZTogXCJIdHNnZXRMYW1iZGFTdGFja1wiLFxuICBkZXNjcmlwdGlvbjogXCJBIHN0YWNrIGRlcGxveWluZyBodHNnZXQtcnMgd2l0aCBBUEkgZ2F0ZXdheS5cIixcbiAgdGFnczoge1xuICAgIFN0YWNrOiBcIkh0c2dldExhbWJkYVN0YWNrXCIsXG4gIH0sXG4gIGVudjoge1xuICAgIGFjY291bnQ6IHByb2Nlc3MuZW52LkNES19ERUZBVUxUX0FDQ09VTlQsXG4gICAgcmVnaW9uOiBwcm9jZXNzLmVudi5DREtfREVGQVVMVF9SRUdJT04sXG4gIH0sXG59KTtcbiJdfQ==
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import * as cdk from "aws-cdk-lib";
|
|
2
|
+
import { Construct } from "constructs";
|
|
3
|
+
import { HtsgetLambdaProps } from "../index";
|
|
4
|
+
import { SETTINGS } from "./settings";
|
|
5
|
+
import { HtsgetLambda } from "../lib/htsget-lambda";
|
|
6
|
+
|
|
7
|
+
export class HtsgetStack extends cdk.Stack {
|
|
8
|
+
constructor(
|
|
9
|
+
scope: Construct,
|
|
10
|
+
id: string,
|
|
11
|
+
settings: HtsgetLambdaProps,
|
|
12
|
+
props?: cdk.StackProps,
|
|
13
|
+
) {
|
|
14
|
+
super(scope, id, props);
|
|
15
|
+
|
|
16
|
+
new HtsgetLambda(this, "HtsgetLambda", settings);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const app = new cdk.App();
|
|
21
|
+
new HtsgetStack(app, "HtsgetLambdaStack", SETTINGS, {
|
|
22
|
+
stackName: "HtsgetLambdaStack",
|
|
23
|
+
description: "A stack deploying htsget-rs with API gateway.",
|
|
24
|
+
tags: {
|
|
25
|
+
Stack: "HtsgetLambdaStack",
|
|
26
|
+
},
|
|
27
|
+
env: {
|
|
28
|
+
account: process.env.CDK_DEFAULT_ACCOUNT,
|
|
29
|
+
region: process.env.CDK_DEFAULT_REGION,
|
|
30
|
+
},
|
|
31
|
+
});
|
package/bin/settings.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SETTINGS = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Settings to use for the htsget deployment.
|
|
6
|
+
*/
|
|
7
|
+
exports.SETTINGS = {
|
|
8
|
+
domain: "dev.umccr.org",
|
|
9
|
+
copyTestData: true,
|
|
10
|
+
gitReference: "htsget-lambda-v0.7.4",
|
|
11
|
+
bucketName: "htsget-data",
|
|
12
|
+
functionName: "htsget-function",
|
|
13
|
+
roleName: "htsget-role",
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic2V0dGluZ3MuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJzZXR0aW5ncy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFFQTs7R0FFRztBQUNVLFFBQUEsUUFBUSxHQUFzQjtJQUN6QyxNQUFNLEVBQUUsZUFBZTtJQUN2QixZQUFZLEVBQUUsSUFBSTtJQUNsQixZQUFZLEVBQUUsc0JBQXNCO0lBQ3BDLFVBQVUsRUFBRSxhQUFhO0lBQ3pCLFlBQVksRUFBRSxpQkFBaUI7SUFDL0IsUUFBUSxFQUFFLGFBQWE7Q0FDeEIsQ0FBQyIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IEh0c2dldExhbWJkYVByb3BzIH0gZnJvbSBcIi4uL2luZGV4XCI7XG5cbi8qKlxuICogU2V0dGluZ3MgdG8gdXNlIGZvciB0aGUgaHRzZ2V0IGRlcGxveW1lbnQuXG4gKi9cbmV4cG9ydCBjb25zdCBTRVRUSU5HUzogSHRzZ2V0TGFtYmRhUHJvcHMgPSB7XG4gIGRvbWFpbjogXCJkZXYudW1jY3Iub3JnXCIsXG4gIGNvcHlUZXN0RGF0YTogdHJ1ZSxcbiAgZ2l0UmVmZXJlbmNlOiBcImh0c2dldC1sYW1iZGEtdjAuNy40XCIsXG4gIGJ1Y2tldE5hbWU6IFwiaHRzZ2V0LWRhdGFcIixcbiAgZnVuY3Rpb25OYW1lOiBcImh0c2dldC1mdW5jdGlvblwiLFxuICByb2xlTmFtZTogXCJodHNnZXQtcm9sZVwiLFxufTtcbiJdfQ==
|
package/bin/settings.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HtsgetLambdaProps } from "../index";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Settings to use for the htsget deployment.
|
|
5
|
+
*/
|
|
6
|
+
export const SETTINGS: HtsgetLambdaProps = {
|
|
7
|
+
domain: "dev.umccr.org",
|
|
8
|
+
copyTestData: true,
|
|
9
|
+
gitReference: "htsget-lambda-v0.7.4",
|
|
10
|
+
bucketName: "htsget-data",
|
|
11
|
+
functionName: "htsget-function",
|
|
12
|
+
roleName: "htsget-role",
|
|
13
|
+
};
|
package/cdk.json
ADDED
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"app": "npx ts-node --prefer-ts-exts bin/htsget-stack.ts",
|
|
3
|
+
"context": {
|
|
4
|
+
"@aws-cdk-containers/ecs-service-extensions:enableDefaultLogDriver": true,
|
|
5
|
+
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
|
|
6
|
+
"@aws-cdk/aws-cloudfront:defaultSecurityPolicyTLSv1.2_2021": true,
|
|
7
|
+
"@aws-cdk/aws-ec2:uniqueImdsv2TemplateName": true,
|
|
8
|
+
"@aws-cdk/aws-iam:minimizePolicies": true,
|
|
9
|
+
"@aws-cdk/aws-lambda:recognizeVersionProps": true,
|
|
10
|
+
"@aws-cdk/aws-rds:lowercaseDbIdentifier": true,
|
|
11
|
+
"@aws-cdk/core:checkSecretUsage": true,
|
|
12
|
+
"@aws-cdk/core:stackRelativeExports": true,
|
|
13
|
+
"@aws-cdk/core:target-partitions": ["aws", "aws-cn"]
|
|
14
|
+
},
|
|
15
|
+
"watch": {
|
|
16
|
+
"exclude": [
|
|
17
|
+
"README.md",
|
|
18
|
+
"cdk*.json",
|
|
19
|
+
"**/*.d.ts",
|
|
20
|
+
"**/*.js",
|
|
21
|
+
"tsconfig.json",
|
|
22
|
+
"package*.json",
|
|
23
|
+
"yarn.lock",
|
|
24
|
+
"node_modules",
|
|
25
|
+
"test"
|
|
26
|
+
],
|
|
27
|
+
"include": ["**"]
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
**htsget-lambda**
|
|
2
|
+
|
|
3
|
+
***
|
|
4
|
+
|
|
5
|
+
# htsget-lambda
|
|
6
|
+
|
|
7
|
+
## CorsConifg
|
|
8
|
+
|
|
9
|
+
Defined in: [aws/lib/config.ts:173](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L173)
|
|
10
|
+
|
|
11
|
+
CORS configuration for the htsget-rs server.
|
|
12
|
+
|
|
13
|
+
### Properties
|
|
14
|
+
|
|
15
|
+
| Property | Type | Default value | Description | Defined in |
|
|
16
|
+
| ------ | ------ | ------ | ------ | ------ |
|
|
17
|
+
| <a id="allowcredentials"></a> `allowCredentials?` | `boolean` | `false` | CORS allow credentials. | [aws/lib/config.ts:179](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L179) |
|
|
18
|
+
| <a id="allowheaders"></a> `allowHeaders?` | `string`[] | `["*"]` | CORS allow headers. | [aws/lib/config.ts:186](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L186) |
|
|
19
|
+
| <a id="allowmethods"></a> `allowMethods?` | `CorsHttpMethod`[] | `[CorsHttpMethod.ANY]` | CORS allow methods. | [aws/lib/config.ts:193](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L193) |
|
|
20
|
+
| <a id="alloworigins"></a> `allowOrigins?` | `string`[] | `["*"]` | CORS allow origins. | [aws/lib/config.ts:200](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L200) |
|
|
21
|
+
| <a id="exposeheaders"></a> `exposeHeaders?` | `string`[] | `["*"]` | CORS expose headers. | [aws/lib/config.ts:207](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L207) |
|
|
22
|
+
| <a id="maxage"></a> `maxAge?` | `Duration` | `Duration.days(30)` | CORS max age. | [aws/lib/config.ts:214](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L214) |
|
|
23
|
+
|
|
24
|
+
***
|
|
25
|
+
|
|
26
|
+
## HtsgetConfig
|
|
27
|
+
|
|
28
|
+
Defined in: [aws/lib/config.ts:221](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L221)
|
|
29
|
+
|
|
30
|
+
Configuration for the htsget-rs server. This allows specifying the options
|
|
31
|
+
available in the htsget-rs config: https://github.com/umccr/htsget-rs/tree/main/htsget-config
|
|
32
|
+
|
|
33
|
+
### Properties
|
|
34
|
+
|
|
35
|
+
| Property | Type | Default value | Description | Defined in |
|
|
36
|
+
| ------ | ------ | ------ | ------ | ------ |
|
|
37
|
+
| <a id="environment_override"></a> `environment_override?` | `Record`\<`string`, `unknown`\> | `undefined` | Any additional htsget-rs options can be specified here as environment variables. These will override any options set in this construct, and allows using advanced configuration. Options here should contain the `HTSGET_` prefix. | [aws/lib/config.ts:247](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L247) |
|
|
38
|
+
| <a id="locations"></a> `locations?` | [`HtsgetLocation`](#htsgetlocation)[] | `[]` | The locations for the htsget-rs server. This is the same as the htsget-rs config locations: https://github.com/umccr/htsget-rs/tree/main/htsget-config#quickstart Any `s3://...` locations will automatically be added to the bucket access policy. | [aws/lib/config.ts:230](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L230) |
|
|
39
|
+
| <a id="service_info"></a> `service_info?` | `Record`\<`string`, `unknown`\> | `undefined` | Service info fields to configure for the server. This is the same as the htsget-rs config service_info: https://github.com/umccr/htsget-rs/tree/main/htsget-config#service-info-config | [aws/lib/config.ts:238](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L238) |
|
|
40
|
+
|
|
41
|
+
***
|
|
42
|
+
|
|
43
|
+
## HtsgetLambdaProps
|
|
44
|
+
|
|
45
|
+
Defined in: [aws/lib/config.ts:10](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L10)
|
|
46
|
+
|
|
47
|
+
Settings related to the htsget lambda construct props.
|
|
48
|
+
|
|
49
|
+
### Properties
|
|
50
|
+
|
|
51
|
+
| Property | Type | Default value | Description | Defined in |
|
|
52
|
+
| ------ | ------ | ------ | ------ | ------ |
|
|
53
|
+
| <a id="bucketname"></a> `bucketName?` | `string` | `undefined` | The name of the bucket to create when using `copyTestData`. Defaults to the auto-generated CDK construct name. | [aws/lib/config.ts:86](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L86) |
|
|
54
|
+
| <a id="buildenvironment"></a> `buildEnvironment?` | `Record`\<`string`, `string`\> | `undefined` | Override the environment variables used to build htsget. Note that this only adds environment variables that get used to build htsget-rs with `cargo`. It has no effect on the environment variables that htsget-rs has when the Lambda function is deployed. In general, leave this undefined unless there is a specific reason to override the build environment. | [aws/lib/config.ts:148](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L148) |
|
|
55
|
+
| <a id="cargolambdaflags"></a> `cargoLambdaFlags?` | `string`[] | `undefined` | Override any cargo lambda flags for the build. By default, features are resolved automatically based on the config and `HtsgetLocation[]`. This option overrides that and any automatically added flags. | [aws/lib/config.ts:68](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L68) |
|
|
56
|
+
| <a id="certificatearn"></a> `certificateArn?` | `string` | `undefined` | The arn of the certificate to use. This will not create a `Certificate` if specified, and will instead lookup an existing one. | [aws/lib/config.ts:116](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L116) |
|
|
57
|
+
| <a id="copytestdata"></a> `copyTestData?` | `boolean` | `false` | Copy the test data directory to a new bucket: https://github.com/umccr/htsget-rs/tree/main/data Also copies the Crypt4GH keys to Secrets Manager. Automatically the htsget-rs server access to the bucket and secrets using the locations config. | [aws/lib/config.ts:79](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L79) |
|
|
58
|
+
| <a id="cors"></a> `cors?` | [`CorsConifg`](#corsconifg) | same as the `CorsConfig` defaults | CORS configuration for the htsget-rs server. Values here are propagated to CORS options in htsget-rs. | [aws/lib/config.ts:45](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L45) |
|
|
59
|
+
| <a id="domain"></a> `domain?` | `string` | `undefined` | The domain name for the htsget server. This must be specified if `httpApi` is not set. This assumes that a `HostedZone` exists for this domain. | [aws/lib/config.ts:24](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L24) |
|
|
60
|
+
| <a id="functionname"></a> `functionName?` | `string` | `undefined` | The name of the Lambda function. Defaults to the auto-generated CDK construct name. | [aws/lib/config.ts:93](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L93) |
|
|
61
|
+
| <a id="gitforceclone"></a> `gitForceClone?` | `boolean` | `false` | Whether to force a git clone for every build. If this is false, then the git repo is only cloned once for every git reference in a temporary directory. Otherwise, the repo is cloned every time. | [aws/lib/config.ts:60](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L60) |
|
|
62
|
+
| <a id="gitreference"></a> `gitReference?` | `string` | `"main"` | The git reference to fetch from the htsget-rs repo. | [aws/lib/config.ts:52](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L52) |
|
|
63
|
+
| <a id="hostedzone"></a> `hostedZone?` | `IHostedZone` | `undefined` | Use the provided hosted zone instead of looking it up from the domain name. | [aws/lib/config.ts:123](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L123) |
|
|
64
|
+
| <a id="htsgetconfig-1"></a> `htsgetConfig?` | [`HtsgetConfig`](#htsgetconfig) | `undefined` | The htsget-rs config options. Use this to specify any locations and htsget-rs options. | [aws/lib/config.ts:16](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L16) |
|
|
65
|
+
| <a id="httpapi"></a> `httpApi?` | `IHttpApi` | `undefined` | Manually specify an `HttpApi`. This will not create a `HostedZone`, any Route53 records, certificates, or authorizers, and will instead rely on the existing `HttpApi`. | [aws/lib/config.ts:108](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L108) |
|
|
66
|
+
| <a id="jwt"></a> `jwt?` | [`JwtConfig`](#jwtconfig) | `undefined`, defaults to a public deployment | Whether this deployment is gated behind a JWT authorizer, or if its public. | [aws/lib/config.ts:38](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L38) |
|
|
67
|
+
| <a id="role"></a> `role?` | `IRole` | `undefined` | Use the provided role instead of creating one. This will ignore any configuration related to permissions for buckets and secrets, and rely on the existing role. | [aws/lib/config.ts:131](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L131) |
|
|
68
|
+
| <a id="rolename"></a> `roleName?` | `string` | `undefined` | The name of the role for the Lambda function. Defaults to the auto-generated CDK construct name. | [aws/lib/config.ts:138](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L138) |
|
|
69
|
+
| <a id="subdomain"></a> `subDomain?` | `string` | `"htsget"` | The domain name prefix to use for the htsget-rs server. | [aws/lib/config.ts:31](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L31) |
|
|
70
|
+
| <a id="vpc"></a> `vpc?` | `IVpc` | `undefined` | Optionally specify a VPC for the Lambda function. | [aws/lib/config.ts:100](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L100) |
|
|
71
|
+
|
|
72
|
+
***
|
|
73
|
+
|
|
74
|
+
## HtsgetLocation
|
|
75
|
+
|
|
76
|
+
Defined in: [aws/lib/config.ts:253](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L253)
|
|
77
|
+
|
|
78
|
+
Config for locations.
|
|
79
|
+
|
|
80
|
+
### Properties
|
|
81
|
+
|
|
82
|
+
| Property | Type | Default value | Description | Defined in |
|
|
83
|
+
| ------ | ------ | ------ | ------ | ------ |
|
|
84
|
+
| <a id="location"></a> `location` | `string` | `undefined` | The location string. | [aws/lib/config.ts:257](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L257) |
|
|
85
|
+
| <a id="private_key"></a> `private_key?` | `string` | `undefined` | Optional Crypt4GH private key secret ARN or name. | [aws/lib/config.ts:263](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L263) |
|
|
86
|
+
| <a id="public_key"></a> `public_key?` | `string` | `undefined` | Optional Crypt4GH public key secret ARN or name. | [aws/lib/config.ts:269](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L269) |
|
|
87
|
+
|
|
88
|
+
***
|
|
89
|
+
|
|
90
|
+
## JwtConfig
|
|
91
|
+
|
|
92
|
+
Defined in: [aws/lib/config.ts:154](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L154)
|
|
93
|
+
|
|
94
|
+
JWT authorization settings.
|
|
95
|
+
|
|
96
|
+
### Properties
|
|
97
|
+
|
|
98
|
+
| Property | Type | Default value | Description | Defined in |
|
|
99
|
+
| ------ | ------ | ------ | ------ | ------ |
|
|
100
|
+
| <a id="audience"></a> `audience?` | `string`[] | `[]` | The JWT audience. | [aws/lib/config.ts:160](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L160) |
|
|
101
|
+
| <a id="coguserpoolid"></a> `cogUserPoolId?` | `string` | `undefined`, creates a new user pool | The cognito user pool id for the authorizer. If this is not set, then a new user pool is created. | [aws/lib/config.ts:167](https://github.com/umccr/htsget-deploy/blob/main/aws/lib/config.ts#L167) |
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Cross account setup
|
|
2
|
+
|
|
3
|
+
The Lambda function for htsget-rs can be set-up to be updated from a different account than the one containing the
|
|
4
|
+
CDK infrastructure.
|
|
5
|
+
|
|
6
|
+
To do this, the [aws-lambda-deploy] action can be used.
|
|
7
|
+
|
|
8
|
+
[aws-lambda-deploy]: https://github.com/aws-actions/aws-lambda-deploy
|
|
9
|
+
|
|
10
|
+
## Process
|
|
11
|
+
|
|
12
|
+
Deploy the htsget infrastructure code to the target account that should contain the infrastructure, using `npx cdk deploy`.
|
|
13
|
+
|
|
14
|
+
After deploying, verify that the server is reachable: `curl https://<domain>/reads/service-info`.
|
|
15
|
+
|
|
16
|
+
Then, create a policy in the target account with the following permissions, matching the [aws-lambda-deploy] action, and
|
|
17
|
+
allowing access to the bucket created by the infrastructure.
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"Version": "2012-10-17",
|
|
22
|
+
"Statement": [
|
|
23
|
+
{
|
|
24
|
+
"Sid": "LambdaDeployPermissions",
|
|
25
|
+
"Effect": "Allow",
|
|
26
|
+
"Action": [
|
|
27
|
+
"lambda:GetFunctionConfiguration",
|
|
28
|
+
"lambda:CreateFunction",
|
|
29
|
+
"lambda:UpdateFunctionCode",
|
|
30
|
+
"lambda:UpdateFunctionConfiguration",
|
|
31
|
+
"lambda:PublishVersion"
|
|
32
|
+
],
|
|
33
|
+
"Resource": "arn:aws:lambda:<region>:<account>:function:<function_name>"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
"Sid":"PassRolesDefinition",
|
|
37
|
+
"Effect":"Allow",
|
|
38
|
+
"Action":[
|
|
39
|
+
"iam:PassRole"
|
|
40
|
+
],
|
|
41
|
+
"Resource":[
|
|
42
|
+
"arn:aws:iam::<account>:role/<function_execution_role_name>"
|
|
43
|
+
]
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"Sid":"S3Access",
|
|
47
|
+
"Effect":"Allow",
|
|
48
|
+
"Action":[
|
|
49
|
+
"s3:ListBucket*",
|
|
50
|
+
"s3:PutObject*",
|
|
51
|
+
"s3:GetObject*"
|
|
52
|
+
],
|
|
53
|
+
"Resource":[
|
|
54
|
+
"arn:aws:s3:::<bucket_name>"
|
|
55
|
+
]
|
|
56
|
+
}
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Then, create a role that has a trust policy for the delegated account, and the permissions of the policy created above,
|
|
62
|
+
optionally add an external id:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"Version": "2012-10-17",
|
|
67
|
+
"Statement": [
|
|
68
|
+
{
|
|
69
|
+
"Effect": "Allow",
|
|
70
|
+
"Action": "sts:AssumeRole",
|
|
71
|
+
"Principal": {
|
|
72
|
+
"AWS": "<delegated_account>"
|
|
73
|
+
},
|
|
74
|
+
"Condition": {
|
|
75
|
+
"StringEquals": {
|
|
76
|
+
"sts:ExternalId": "<external_id>"
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
]
|
|
81
|
+
}
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
To test that the setup works, attempt to update the Lambda function from the delegated account:
|
|
85
|
+
|
|
86
|
+
```sh
|
|
87
|
+
aws lambda get-function-configuration --function-name <function_name>
|
|
88
|
+
```
|
package/index.d.ts
ADDED
package/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./lib/htsget-lambda"), exports);
|
|
18
|
+
__exportStar(require("./lib/config"), exports);
|
|
19
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyJpbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsc0RBQW9DO0FBQ3BDLCtDQUE2QiIsInNvdXJjZXNDb250ZW50IjpbImV4cG9ydCAqIGZyb20gXCIuL2xpYi9odHNnZXQtbGFtYmRhXCI7XG5leHBvcnQgKiBmcm9tIFwiLi9saWIvY29uZmlnXCI7XG4iXX0=
|
package/index.ts
ADDED