1
- # Serverless AWS SDK
1
+ # AWS SDK Extra
2
2
3
- The aws sdk + powerful high-level serverless utils .
3
+ The AWS SDK + a handful of extra convenience methods .
4
4
5
5
``` js
6
6
// require the serverless aws sdk.
7
- const aws = require (` @serverless/aws-sdk` )
7
+ const aws = require (` @serverless/aws-sdk-extra ` )
8
8
9
9
// set credentials, as usual.
10
10
aws .config .update ({
11
11
credentials: { accessKeyId: ' xxx' , secretAccessKey: ' xxx' },
12
12
region: ' us-east-1'
13
13
})
14
14
15
- // use any service, as usual.
15
+ // initialize any service, as usual.
16
16
const s3 = new aws.S3 ()
17
17
18
- // use some powerful utils. More info below.
19
- const certificate = await aws .utils .deployCertificate (params)
18
+ // initialize the extra service for more power
19
+ const extra = new aws.Extra ()
20
+
21
+ // call some powerful extra methods. More info below.
22
+ const certificate = await extra .deployCertificate (params)
20
23
```
21
24
22
25
# Reference
@@ -49,7 +52,7 @@ const {
49
52
certificateArn ,
50
53
certificateStatus ,
51
54
domainHostedZoneId
52
- } = await aws . utils .deployDistributionDomain (params)
55
+ } = await extra .deployDistributionDomain (params)
53
56
```
54
57
55
58
# deployCertificate
@@ -61,7 +64,7 @@ const params = {
61
64
domain: ' serverless.com'
62
65
}
63
66
64
- const { certificateArn , certificateStatus , domainHostedZoneId } = await aws . utils .deployCertificate (
67
+ const { certificateArn , certificateStatus , domainHostedZoneId } = await extra .deployCertificate (
65
68
params
66
69
)
67
70
```
@@ -76,7 +79,7 @@ const params = {
76
79
distributionUrl: ' xxx.cloudfront.net'
77
80
}
78
81
79
- const { domainHostedZoneId } = await aws . utils .deployDistributionDns (params)
82
+ const { domainHostedZoneId } = await extra .deployDistributionDns (params)
80
83
```
81
84
82
85
# addDomainToDistribution
@@ -90,7 +93,7 @@ const params = {
90
93
certificateStatus: ' ISSUED'
91
94
}
92
95
93
- const { domainHostedZoneId } = await aws . utils .addDomainToDistribution (params)
96
+ const { domainHostedZoneId } = await extra .addDomainToDistribution (params)
94
97
```
95
98
96
99
# getDomainHostedZoneId
@@ -102,7 +105,7 @@ const params = {
102
105
domain: ' serverless.com'
103
106
}
104
107
105
- const { domainHostedZoneId } = await aws . utils .getDomainHostedZoneId (params)
108
+ const { domainHostedZoneId } = await extra .getDomainHostedZoneId (params)
106
109
```
107
110
108
111
# deployRole
@@ -126,7 +129,7 @@ const params = {
126
129
}
127
130
]
128
131
}
129
- const { roleArn } = await aws . utils .deployRole (params)
132
+ const { roleArn } = await extra .deployRole (params)
130
133
```
131
134
132
135
Or you can specify the policy as a maanged policy arn string:
@@ -137,7 +140,7 @@ const params = {
137
140
service: ' lambda.amazonaws.com' ,
138
141
policy: ' arn:aws:iam::aws:policy/service-role/AWSLambdaBasicExecutionRole'
139
142
}
140
- const { roleArn } = await aws . utils .deployRole (params)
143
+ const { roleArn } = await extra .deployRole (params)
141
144
```
142
145
143
146
If you don't specify a policy property, an admin policy will be created by default.
@@ -151,7 +154,7 @@ const params = {
151
154
name: ' my-role'
152
155
}
153
156
154
- await aws . utils .removeRole (params)
157
+ await extra .removeRole (params)
155
158
```
156
159
157
160
# removeRolePolicies
@@ -163,7 +166,7 @@ const params = {
163
166
name: ' my-role'
164
167
}
165
168
166
- await aws . utils .removeRolePolicies (params)
169
+ await extra .removeRolePolicies (params)
167
170
```
168
171
169
172
# deployLambda
@@ -184,7 +187,7 @@ const lambdaParams = {
184
187
- subnet- xxx
185
188
}
186
189
187
- const { lambdaArn , lambdaSize , lambdaSha } = await aws . utils .deployLambda (params)
190
+ const { lambdaArn , lambdaSize , lambdaSha } = await extra .deployLambda (params)
188
191
```
189
192
190
193
# deployApigDomainDns
@@ -198,7 +201,7 @@ const lambdaParams = {
198
201
apigatewayDomainName: ' d-qwertyuiop.xxx.com' // required. The regional endpoint of the APIG custom domain
199
202
}
200
203
201
- const { domainHostedZoneId } = await aws . utils .deployApigDomainDns (params)
204
+ const { domainHostedZoneId } = await extra .deployApigDomainDns (params)
202
205
```
203
206
204
207
# deployAppSyncApi
@@ -211,7 +214,7 @@ const deployAppSyncApiParams = {
211
214
apiId: ' xxx' // if provided, updates the API. If not provided, creates a new API
212
215
}
213
216
214
- const { apiId , apiUrls } = await aws . utils .deployAppSyncApi (params)
217
+ const { apiId , apiUrls } = await extra .deployAppSyncApi (params)
215
218
```
216
219
217
220
# deployAppSyncSchema
@@ -224,7 +227,7 @@ const deployAppSyncSchemaParams = {
224
227
schema: ' ...' // valid graphql schema
225
228
}
226
229
227
- await aws . utils .deployAppSyncApi (params)
230
+ await extra .deployAppSyncApi (params)
228
231
```
229
232
230
233
# deployAppSyncResolvers
@@ -249,5 +252,5 @@ const deployAppSyncResolversParams = {
249
252
}
250
253
}
251
254
252
- await aws . utils .deployAppSyncResolvers (params)
255
+ await extra .deployAppSyncResolvers (params)
253
256
```
0 commit comments