aws-architect 6.7.80 → 6.7.82
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/README.md +41 -81
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,75 +1,38 @@
|
|
|
1
1
|
# AWS Architect
|
|
2
2
|
|
|
3
|
-
A hardened orchestrator for deploying Lambda microservices and S3 backed websites to AWS, using best practices, and an SDK that handles every possible edge case
|
|
3
|
+
A hardened orchestrator for deploying Lambda microservices and S3 backed websites to AWS, using best practices, and an SDK that handles every possible edge case, with a focus on **safety**.
|
|
4
4
|
|
|
5
5
|
This is an open source project managed by the [Authress Engineering team](https://authress.io).
|
|
6
|
-
|
|
7
|
-
[](https://authress.io) [](https://badge.fury.io/js/aws-architect)
|
|
8
6
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
##### Lambda with no API sample
|
|
36
|
-
Additionally, `openapi-factory` is not required, and executing the lambda handler directly can be done as well.
|
|
37
|
-
|
|
38
|
-
```javascript
|
|
39
|
-
exports.handler = (event, context, callback) => {
|
|
40
|
-
console.log(`event: ${JSON.stringify(event, null, 2)}`);
|
|
41
|
-
console.log(`context: ${JSON.stringify(context, null, 2)}`);
|
|
42
|
-
callback(null, {Event: event, Context: context});
|
|
43
|
-
};
|
|
44
|
-
```
|
|
45
|
-
##### Set a custom authorizer
|
|
46
|
-
In some cases authorization is necessary. Cognito is always an option, but for more fine grained control, your lambda can double as an authorizer.
|
|
7
|
+
<p align="center">
|
|
8
|
+
<a href="https://authress.io" alt="Authress Engineering">
|
|
9
|
+
<img src="https://img.shields.io/static/v1?label=Authress+Engineering&message=OpenAPI%20Explorer&color=%23FBAF0B&logo=androidauto&logoColor=%23FBAF0B"></a>
|
|
10
|
+
<a href="./LICENSE" alt="apache 2.0 license">
|
|
11
|
+
<img src="https://img.shields.io/badge/license-Apache%202.0-blue.svg"></a>
|
|
12
|
+
<a href="https://badge.fury.io/js/aws-architect" alt="npm version">
|
|
13
|
+
<img src="https://badge.fury.io/js/aws-architect.svg"></a>
|
|
14
|
+
<a href="https://authress.io/community" alt="npm version">
|
|
15
|
+
<img src="https://img.shields.io/badge/community-Discord-purple.svg"></a>
|
|
16
|
+
</p>
|
|
17
|
+
|
|
18
|
+
## Features
|
|
19
|
+
|
|
20
|
+
* Standardized CF template to deploy microservice to Lambda, API Gateway, Route 53, etc..
|
|
21
|
+
* Standardized CF template for S3 bucket hosting for a website
|
|
22
|
+
* Default configuration to automatically handle the creation of pull request deployments to test infrastructure before production
|
|
23
|
+
* Working templated sample and make.js file to run locally and CI build.
|
|
24
|
+
* Lambda/API Gateway setup for seamless integration.
|
|
25
|
+
* Automatic creation of AWS resources when using including:
|
|
26
|
+
* Lambda functions
|
|
27
|
+
* API Gateway resources
|
|
28
|
+
* Environments for managing resources in AWS
|
|
29
|
+
* S3 Buckets and directories
|
|
30
|
+
* S3 static website hosting
|
|
31
|
+
* Developer testing platform, to run lambdas and static content as a local express Node.js service, to test locally. Integrates with [OpenAPI-Factory](https://github.com/Authress-Engineering/openapi-factory.js#readme)
|
|
47
32
|
|
|
48
|
-
|
|
49
|
-
api.SetAuthorizer(event => {
|
|
50
|
-
return {
|
|
51
|
-
principalId: 'computed-authorized-principal-id',
|
|
52
|
-
policyDocument: {
|
|
53
|
-
Version: '2012-10-17',
|
|
54
|
-
Statement: [
|
|
55
|
-
{
|
|
56
|
-
Action: 'execute-api:Invoke',
|
|
57
|
-
Effect: 'Deny',
|
|
58
|
-
Resource: event.methodArn //'arn:aws:execute-api:*:*:*'
|
|
59
|
-
}
|
|
60
|
-
]
|
|
61
|
-
},
|
|
62
|
-
context: {
|
|
63
|
-
"stringKey": "string-val",
|
|
64
|
-
"numberKey": 123,
|
|
65
|
-
"booleanKey": true
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
});
|
|
69
|
-
```
|
|
33
|
+
## Usage
|
|
70
34
|
|
|
71
35
|
### Library Functions
|
|
72
|
-
#### AwsArchitect class functions
|
|
73
36
|
|
|
74
37
|
```javascript
|
|
75
38
|
let packageMetadataFile = path.join(__dirname, 'package.json');
|
|
@@ -134,7 +97,7 @@ run(port, logger) {...}
|
|
|
134
97
|
|
|
135
98
|
```
|
|
136
99
|
|
|
137
|
-
|
|
100
|
+
### Example: S3 Website Deployment
|
|
138
101
|
AWS Architect has the ability to set up and configure an S3 bucket for static website hosting. It provides a mechanism as well to deploy your content files directly to S3.
|
|
139
102
|
Specify `bucket` in the configuration options for `contentOptions`, and configure the `PublishWebsite` function in the make.js file.
|
|
140
103
|
|
|
@@ -148,8 +111,7 @@ Specify `bucket` in the configuration options for `contentOptions`, and configur
|
|
|
148
111
|
.catch((failure) => console.log(`Failed copying stage to production ${failure} - ${JSON.stringify(failure, null, 2)}`));
|
|
149
112
|
```
|
|
150
113
|
|
|
151
|
-
|
|
152
|
-
Publishing the website has an `options` object which defaults to:
|
|
114
|
+
Configuration Options: Publishing the website has an `options` object which defaults to:
|
|
153
115
|
```js
|
|
154
116
|
{
|
|
155
117
|
// provide overrides for paths to change bucket cache control policy, default 600 seconds,
|
|
@@ -160,22 +122,20 @@ Publishing the website has an `options` object which defaults to:
|
|
|
160
122
|
]
|
|
161
123
|
}
|
|
162
124
|
```
|
|
163
|
-
## Built-in functionality
|
|
164
125
|
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
*
|
|
169
|
-
*
|
|
170
|
-
*
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
*
|
|
174
|
-
*
|
|
175
|
-
|
|
176
|
-
* Developer testing platform, to run lambdas and static content as a local express Node.js service, to test locally.
|
|
126
|
+
### CLI: Creating a microservice: `init`
|
|
127
|
+
This will also configure your aws account to allow your build system to automatically deploy to AWS. Run locally
|
|
128
|
+
|
|
129
|
+
* Create git repository and clone locally
|
|
130
|
+
* `npm install aws-architect -g`
|
|
131
|
+
* `aws-architect init`
|
|
132
|
+
* `npm install`
|
|
133
|
+
* Update:
|
|
134
|
+
* `package.json`: package name, the package name is used to name your resources
|
|
135
|
+
* `make.js`: Deployment bucket, Resource, and DNS name parameters which are used for CF deployment
|
|
136
|
+
|
|
177
137
|
|
|
178
|
-
|
|
138
|
+
## Built-in SAM and CFN templates:
|
|
179
139
|
See [template service documentation](./bin/template/README.md) for how individual parts of the service are configured.
|
|
180
140
|
|
|
181
141
|
## Also
|