Skip to content

Commit

Permalink
implement
Browse files Browse the repository at this point in the history
  • Loading branch information
yh1224 committed Apr 29, 2023
1 parent 8d1ef97 commit 6e231e9
Show file tree
Hide file tree
Showing 8 changed files with 7,259 additions and 46 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ node_modules
# CDK asset staging directory
.cdk.staging
cdk.out

/.idea
22 changes: 4 additions & 18 deletions bin/aws-voicevox-proxy.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,7 @@
#!/usr/bin/env node
import 'source-map-support/register';
import * as cdk from 'aws-cdk-lib';
import { AwsVoicevoxProxyStack } from '../lib/aws-voicevox-proxy-stack';
import "source-map-support/register";
import * as cdk from "aws-cdk-lib";
import {AwsVoicevoxProxyStack} from "../lib/aws-voicevox-proxy-stack";

const app = new cdk.App();
new AwsVoicevoxProxyStack(app, 'AwsVoicevoxProxyStack', {
/* If you don't specify 'env', this stack will be environment-agnostic.
* Account/Region-dependent features and context lookups will not work,
* but a single synthesized template can be deployed anywhere. */

/* Uncomment the next line to specialize this stack for the AWS Account
* and Region that are implied by the current CLI configuration. */
// env: { account: process.env.CDK_DEFAULT_ACCOUNT, region: process.env.CDK_DEFAULT_REGION },

/* Uncomment the next line if you know exactly what Account and Region you
* want to deploy the stack to. */
// env: { account: '123456789012', region: 'us-east-1' },

/* For more information, see https://docs.aws.amazon.com/cdk/latest/guide/environments.html */
});
new AwsVoicevoxProxyStack(app, "AwsVoicevoxProxyStack", {});
31 changes: 20 additions & 11 deletions lib/aws-voicevox-proxy-stack.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,25 @@
import * as cdk from 'aws-cdk-lib';
import { Construct } from 'constructs';
// import * as sqs from 'aws-cdk-lib/aws-sqs';
import * as cdk from "aws-cdk-lib";
import * as lambda from "aws-cdk-lib/aws-lambda";
import * as logs from "aws-cdk-lib/aws-logs";
import {Construct} from "constructs";
import * as path from "path";

export class AwsVoicevoxProxyStack extends cdk.Stack {
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);
constructor(scope: Construct, id: string, props?: cdk.StackProps) {
super(scope, id, props);

// The code that defines your stack goes here
const apiFunc = new lambda.DockerImageFunction(this, "ApiFunc", {
code: lambda.DockerImageCode.fromImageAsset(path.resolve(__dirname, "../src/lambdas/ApiFunc/")),
logRetention: logs.RetentionDays.ONE_WEEK,
memorySize: 2048,
timeout: cdk.Duration.seconds(30),
});
const url = apiFunc.addFunctionUrl({
authType: lambda.FunctionUrlAuthType.NONE,
});

// example resource
// const queue = new sqs.Queue(this, 'AwsVoicevoxProxyQueue', {
// visibilityTimeout: cdk.Duration.seconds(300)
// });
}
new cdk.CfnOutput(this, "ApiUrl", {
value: url.url,
});
}
}
Loading

0 comments on commit 6e231e9

Please sign in to comment.