Skip to content

Commit

Permalink
Separate AWS regions for S3 and Lambda (#6)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
benmarch committed Nov 26, 2022
1 parent d3b51f6 commit d8dc6d3
Show file tree
Hide file tree
Showing 12 changed files with 3,477 additions and 458 deletions.
22 changes: 22 additions & 0 deletions .eslintrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{
"env": {
"node": true,
"commonjs": true,
"es2021": true,
"jest/globals": true
},
"plugins": [
"jest"
],
"extends": [
"eslint:recommended",
"prettier"
],
"parserOptions": {
"ecmaVersion": "latest"
},
"globals": {

},
"rules": {}
}
4 changes: 4 additions & 0 deletions .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npx lint-staged
4 changes: 4 additions & 0 deletions .husky/pre-push
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm test
3 changes: 3 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
coverage/
node_modules/
jest.config.js
6 changes: 6 additions & 0 deletions .prettierrc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"printWidth": 120,
"semi": false,
"singleQuote": true,
"trailingComma": "all"
}
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,10 @@ It is quite verbose, but manageable when it does not need to be executed often a
The preferred way is to use a configuration file that specifies information about all Lambda@Edge functions for a specific CloudFront distribution.
Even if there is only one Lambda@Edge function attached to the distribution, the configuration file can simplify the commands considerably.

**Note:** If your S3 bucket used to store the Lambda ZIP files is in a different AWS region than where the base Lambda functions
are deployed, replace `awsRegion` with `s3Region` and `lambdaRegion`. This might be the case if your company has strict security
or compliance requirements.

Start with this configuration file template and modify to fit your needs (triggers can be removed if not used):
```json
{
Expand Down Expand Up @@ -121,7 +125,9 @@ The following options are global to all commands:

- `--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.
- `--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()`
- `--region`: Sets the AWS region. Defaults to `'us-east-1'`
- `--region`: Sets the AWS region for both S3 and Lambda. Defaults to `'us-east-1'`
- `--s3-region`: Sets the AWS region for S3. Overrides the `--region` option, requires `--lambda-region` to be set also.
- `--lambda-region`: Sets the AWS region for Lambda. Overrides the `--region` option, requires `--s3-region` to be set also.
- `--config`: The path to the configuration file (can be relative to pwd or absolute)
- `--vreq`: If using a configuration file, executes the command for the Viewer Request trigger (if configured)
- `--oreq`: If using a configuration file, executes the command for the Origin Request trigger (if configured)
Expand Down Expand Up @@ -295,7 +301,7 @@ Then I have a downstream job to run the rest of the Prod commands to activate th

## Contributing

Feel free to open a pull request.
Feel free to open an issue with a feature request or a pull request.

## License

Expand Down
Loading

0 comments on commit d8dc6d3

Please sign in to comment.