Skip to content

Commit e0d17ed

Browse files
authored
Support region and profile
Added region and profile support at `runAwsCommand`. User can specify `region` and/or `profile` in the provider section of serverless.yml.
1 parent f6b1f98 commit e0d17ed

File tree

1 file changed

+8
-1
lines changed
  • aws-node-single-page-app-via-cloudfront/serverless-single-page-app-plugin

1 file changed

+8
-1
lines changed

aws-node-single-page-app-via-cloudfront/serverless-single-page-app-plugin/index.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,14 @@ class ServerlessPlugin {
3737
}
3838

3939
runAwsCommand(args) {
40-
const result = spawnSync('aws', args);
40+
let command = 'aws';
41+
if (this.serverless.variables.service.provider.region) {
42+
command = `${command} --region ${this.serverless.variables.service.provider.region}`;
43+
}
44+
if (this.serverless.variables.service.provider.profile) {
45+
command = `${command} --profile ${this.serverless.variables.service.provider.profile}`;
46+
}
47+
const result = spawnSync(command, args);
4148
const stdout = result.stdout.toString();
4249
const sterr = result.stderr.toString();
4350
if (stdout) {

0 commit comments

Comments
 (0)