diff --git a/builtin/credential/aws/path_login.go b/builtin/credential/aws/path_login.go index 66effda56773..60547a8cf3ec 100644 --- a/builtin/credential/aws/path_login.go +++ b/builtin/credential/aws/path_login.go @@ -943,7 +943,13 @@ func (b *backend) pathLoginRenewIam( } } - return framework.LeaseExtend(roleEntry.TTL, roleEntry.MaxTTL, b.System())(req, data) + // If 'Period' is set on the role, then the token should never expire. + if roleEntry.Period > time.Duration(0) { + req.Auth.TTL = roleEntry.Period + return &logical.Response{Auth: req.Auth}, nil + } else { + return framework.LeaseExtend(roleEntry.TTL, roleEntry.MaxTTL, b.System())(req, data) + } } func (b *backend) pathLoginRenewEc2(