Skip to content

Commit d8dc6d3

Browse files
authored
Separate AWS regions for S3 and Lambda (#6)
* Added Prettier, ESLint, and Husky * Added options for separate S3 and Lambda regions. Removed CloudFront region. * Updated README * Bumped version to 1.2.0-rc.0
1 parent d3b51f6 commit d8dc6d3

12 files changed

+3477
-458
lines changed

.eslintrc.json

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"env": {
3+
"node": true,
4+
"commonjs": true,
5+
"es2021": true,
6+
"jest/globals": true
7+
},
8+
"plugins": [
9+
"jest"
10+
],
11+
"extends": [
12+
"eslint:recommended",
13+
"prettier"
14+
],
15+
"parserOptions": {
16+
"ecmaVersion": "latest"
17+
},
18+
"globals": {
19+
20+
},
21+
"rules": {}
22+
}

.husky/pre-commit

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npx lint-staged

.husky/pre-push

+4
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#!/usr/bin/env sh
2+
. "$(dirname -- "$0")/_/husky.sh"
3+
4+
npm test

.prettierignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
coverage/
2+
node_modules/
3+
jest.config.js

.prettierrc.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"printWidth": 120,
3+
"semi": false,
4+
"singleQuote": true,
5+
"trailingComma": "all"
6+
}

README.md

+8-2
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,10 @@ It is quite verbose, but manageable when it does not need to be executed often a
4949
The preferred way is to use a configuration file that specifies information about all Lambda@Edge functions for a specific CloudFront distribution.
5050
Even if there is only one Lambda@Edge function attached to the distribution, the configuration file can simplify the commands considerably.
5151

52+
**Note:** If your S3 bucket used to store the Lambda ZIP files is in a different AWS region than where the base Lambda functions
53+
are deployed, replace `awsRegion` with `s3Region` and `lambdaRegion`. This might be the case if your company has strict security
54+
or compliance requirements.
55+
5256
Start with this configuration file template and modify to fit your needs (triggers can be removed if not used):
5357
```json
5458
{
@@ -121,7 +125,9 @@ The following options are global to all commands:
121125

122126
- `--dry-run`: Executes the command but does not make any changes in AWS. Note: it still needs to access AWS for metadata such as Lambda versions and CloudFront configurations.
123127
- `--pwd`: Sets the present working directory. All relative paths (for config file and local file path) will resolve from this value. Defaults to `process.cwd()`
124-
- `--region`: Sets the AWS region. Defaults to `'us-east-1'`
128+
- `--region`: Sets the AWS region for both S3 and Lambda. Defaults to `'us-east-1'`
129+
- `--s3-region`: Sets the AWS region for S3. Overrides the `--region` option, requires `--lambda-region` to be set also.
130+
- `--lambda-region`: Sets the AWS region for Lambda. Overrides the `--region` option, requires `--s3-region` to be set also.
125131
- `--config`: The path to the configuration file (can be relative to pwd or absolute)
126132
- `--vreq`: If using a configuration file, executes the command for the Viewer Request trigger (if configured)
127133
- `--oreq`: If using a configuration file, executes the command for the Origin Request trigger (if configured)
@@ -295,7 +301,7 @@ Then I have a downstream job to run the rest of the Prod commands to activate th
295301

296302
## Contributing
297303

298-
Feel free to open a pull request.
304+
Feel free to open an issue with a feature request or a pull request.
299305

300306
## License
301307

0 commit comments

Comments
 (0)