1
0
mirror of https://github.com/raseels-repos/golang-saas-starter-kit.git synced 2025-06-15 00:15:15 +02:00

Init aws session with region when using role

This commit is contained in:
Lee Brown
2019-07-14 00:54:51 -08:00
parent db07498192
commit 8f5ff1ec1e
7 changed files with 38 additions and 2 deletions

View File

@ -183,7 +183,12 @@ func (creds awsCredentials) Session() *session.Session {
// Get an AWS session from an implicit source if no explicit
// configuration is provided. This is useful for taking advantage of
// EC2/ECS instance roles.
return session.Must(session.NewSession())
sess := session.Must(session.NewSession())
if creds.Region != "" {
sess.Config.WithRegion(creds.Region)
}
return sess
}
return session.New(

View File

@ -726,7 +726,7 @@ func NewServiceDeployRequest(log *log.Logger, flags ServiceDeployFlags) (*servic
// RDS settings for a Postgres database Instance. Could defined different settings by env.
req.DBInstance = &rds.CreateDBInstanceInput{
DBInstanceIdentifier: aws.String(req.ProjectName + "-" + req.Env + "-01"),
DBInstanceIdentifier: aws.String(req.ProjectName + "-" + req.Env),
DBName: aws.String("shared"),
Engine: aws.String("postgres"),
MasterUsername: aws.String("god"),