Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 9a8eff0

Browse files
authored
Merge pull request #267 from commandeer/resize-image
changes
2 parents 4523f80 + 1fa19b1 commit 9a8eff0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+3379
-1
lines changed

‎sample-apps/cdk/s3-lambda‎

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
# Logs
2+
logs
3+
*.log
4+
npm-debug.log*
5+
yarn-debug.log*
6+
yarn-error.log*
7+
lerna-debug.log*
8+
9+
# Diagnostic reports (https://nodejs.org/api/report.html)
10+
report.[0-9]*.[0-9]*.[0-9]*.[0-9]*.json
11+
12+
# Runtime data
13+
pids
14+
*.pid
15+
*.seed
16+
*.pid.lock
17+
18+
# Directory for instrumented libs generated by jscoverage/JSCover
19+
lib-cov
20+
21+
# Coverage directory used by tools like istanbul
22+
coverage
23+
*.lcov
24+
25+
# nyc test coverage
26+
.nyc_output
27+
28+
# Grunt intermediate storage (https://gruntjs.com/creating-plugins#storing-task-files)
29+
.grunt
30+
31+
# Bower dependency directory (https://bower.io/)
32+
bower_components
33+
34+
# node-waf configuration
35+
.lock-wscript
36+
37+
# Compiled binary addons (https://nodejs.org/api/addons.html)
38+
build/Release
39+
40+
# Dependency directories
41+
node_modules/
42+
jspm_packages/
43+
44+
# TypeScript v1 declaration files
45+
typings/
46+
47+
# TypeScript cache
48+
*.tsbuildinfo
49+
50+
# Optional npm cache directory
51+
.npm
52+
53+
# Optional eslint cache
54+
.eslintcache
55+
56+
# Microbundle cache
57+
.rpt2_cache/
58+
.rts2_cache_cjs/
59+
.rts2_cache_es/
60+
.rts2_cache_umd/
61+
62+
# Optional REPL history
63+
.node_repl_history
64+
65+
# Output of 'npm pack'
66+
*.tgz
67+
68+
# Yarn Integrity file
69+
.yarn-integrity
70+
71+
# dotenv environment variables file
72+
.env
73+
.env.test
74+
75+
# parcel-bundler cache (https://parceljs.org/)
76+
.cache
77+
78+
# Next.js build output
79+
.next
80+
81+
# Nuxt.js build / generate output
82+
.nuxt
83+
dist
84+
85+
# Gatsby files
86+
.cache/
87+
# Comment in the public line in if your project uses Gatsby and *not* Next.js
88+
# https://nextjs.org/blog/next-9-1#public-directory-support
89+
# public
90+
91+
# vuepress build output
92+
.vuepress/dist
93+
94+
# Serverless directories
95+
.serverless/
96+
97+
# FuseBox cache
98+
.fusebox/
99+
100+
# DynamoDB Local files
101+
.dynamodb/
102+
103+
# TernJS port file
104+
.tern-port
105+
106+
.DS_Store
107+
108+
# CDK build folders
109+
cdk.out
110+
build
111+
112+
# Config files
113+
src/config/*.json
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
# Welcome to the Video Backend Project!
2+
3+
This project handles the creation of the Video infrastructure using CDK.
4+
5+
The CDK files are located in the ./bin and ./lib folders. These are used to create the stack. The stack can be created on AWS or on LocalStack.
6+
7+
The Lambda code is located in the ./src folder.
8+
9+
All tests for the code are located in the ./test folder.
10+
11+
## Useful commands
12+
13+
* `yarn build` compile typescript to js
14+
* `yarn watch` watch for changes and compile
15+
* `yarn test` perform the unit tests
16+
* `cdk deploy` deploy this stack to your default AWS account/region
17+
* `cdk diff` compare deployed stack with current state
18+
* `cdk synth` emits the synthesized CloudFormation template
19+
20+
## Setup
21+
22+
```
23+
npm install -g aws-cdk-local aws-cdk
24+
25+
cdklocal --version
26+
```
27+
28+
## LocalStack Deploy
29+
```
30+
# Set these in your .aws/credentials file
31+
[default]
32+
aws_access_key_id = test
33+
aws_secret_access_key = test
34+
35+
yarn build
36+
cdklocal boostrap
37+
yarn deply:lcl
38+
```
39+
40+
## AWS Deploy
41+
```
42+
# Need to set for the proper environment
43+
VIDEO_ENV=dev
44+
CDK_DEFAULT_ACCOUNT=accountId
45+
46+
cdk bootstrap aws://ACCOUNT_ID/REGION
47+
yarn deploy
48+
```
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env node
2+
import * as cdk from 'aws-cdk-lib';
3+
import 'source-map-support/register';
4+
import { VideoS3 } from '../lib';
5+
6+
/******************************************************************************
7+
* Environment Information - see https://docs.aws.amazon.com/cdk/latest/guide/environments.html
8+
* If you don't specify 'env', this stack will be environment-agnostic.
9+
* Account/Region-dependent features and context lookups will not work,
10+
* but a single synthesized template can be deployed anywhere.
11+
********************************************************************************/
12+
13+
const app = new cdk.App();
14+
const props = {
15+
env: {
16+
account: process.env.CDK_DEFAULT_ACCOUNT,
17+
region: process.env.CDK_DEFAULT_REGION,
18+
},
19+
};
20+
21+
new VideoS3(app, 'VideoS3', {
22+
description: 'Video S3 Buckets',
23+
...props
24+
});
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"app": "npx ts-node --prefer-ts-exts bin/video-cdk.ts",
3+
"context": {
4+
"@aws-cdk/aws-apigateway:usagePlanKeyOrderInsensitiveId": true,
5+
"aws-cdk:enableDiffNoFail": "true",
6+
"@aws-cdk/core:stackRelativeExports": "true",
7+
"@aws-cdk/aws-ecr-assets:dockerIgnoreSupport": true,
8+
"@aws-cdk/aws-secretsmanager:parseOwnedSecretName": true,
9+
"@aws-cdk/aws-kms:defaultKeyPolicies": true,
10+
"@aws-cdk/aws-s3:grantWriteWithoutAcl": true,
11+
"@aws-cdk/aws-ecs-patterns:removeDefaultDesiredCount": true,
12+
"@aws-cdk/aws-rds:lowercaseDbIdentifier": true,
13+
"@aws-cdk/aws-efs:defaultEncryptionAtRest": true,
14+
"@aws-cdk/aws-lambda:recognizeVersionProps": true,
15+
"@aws-cdk/core:newStyleStackSynthesis": false
16+
}
17+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
import * as cdk from 'aws-cdk-lib';
2+
import { CfnOutputProps } from 'aws-cdk-lib';
3+
import { Construct } from 'constructs';
4+
5+
/**
6+
* @description - add CDK outputs to the CloudFormation stack
7+
* @param scope
8+
* @param name
9+
* @param value
10+
* @param description
11+
* @param exportName
12+
*/
13+
export function addOutput(scope: Construct, name: string, value: string, description: string, exportName: string) {
14+
const props: CfnOutputProps = {
15+
value,
16+
description,
17+
exportName,
18+
};
19+
20+
new cdk.CfnOutput(scope, name, props);
21+
}

‎sample-apps/cdk/s3-lambda-test/lib/iam/index.ts‎

Whitespace-only changes.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './video-s3';
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
import * as cdk from 'aws-cdk-lib';
2+
import { NodejsFunction } from 'aws-cdk-lib/aws-lambda-nodejs';
3+
import * as lambda from 'aws-cdk-lib/aws-lambda';
4+
import { Construct } from 'constructs';
5+
import { addOutput } from '../_helper';
6+
import * as path from 'path';
7+
8+
export class VideoWatermarkHandler {
9+
public readonly id = 'videoWatermarkHandler';
10+
public readonly description = 'Video Watermarking lambda that receives a video from the media bucket and saves it to the media-watermark bucket';
11+
public instance: NodejsFunction;
12+
13+
constructor(scope: Construct, props: any) {
14+
this.instance = new NodejsFunction(scope, this.id, {
15+
description: this.description,
16+
functionName: this.id,
17+
runtime: lambda.Runtime.NODEJS_14_X,
18+
memorySize: 1024,
19+
timeout: cdk.Duration.seconds(900), // 15 minutes
20+
handler: 'main',
21+
entry: path.join(__dirname, `/../../src/video/videoWatermarkHandler.ts`),
22+
environment: {
23+
VIDEO_ENV: process.env.VIDEO_ENV || 'dev',
24+
VERBOSE: process.env.VERBOSE || 'false',
25+
},
26+
});
27+
28+
cdk.Tags.of(scope).add('Service', 'Media');
29+
cdk.Tags.of(scope).add('Environment', props.envName.valueAsString);
30+
31+
// add output for the stack
32+
addOutput(scope, 'videoWatermarkHandlerLambdaName', this.instance.functionName, this.description,`${this.id}Name`);
33+
addOutput(scope, 'videoWatermarkHandlerLambdaArn', this.instance.functionArn, this.description,`${this.id}Arn`);
34+
}
35+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
export * from './VideoWatermarkHandler';

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /