Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
C
configuration
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
configuration
Commits
5b9807d5
Commit
5b9807d5
authored
Sep 30, 2016
by
Kevin Falcone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Script for assuming role by an automated process
parent
e6749580
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
0 deletions
+24
-0
util/jenkins/assume-role.sh
+24
-0
No files found.
util/jenkins/assume-role.sh
0 → 100644
View file @
5b9807d5
#!/usr/bin/env bash
# assume-role function for use by machine services that don't use MFA to assume role.
# source this into your bash script and then
# set +x
# assume-role(${AWS_MFA_ARN})
# set -x
# You can skip set +-x if you aren't concerned about leaking the tokens in your logs.
assume-role
()
{
ROLE_ARN
=
"
${
1
}
"
SESSIONID
=
$(
date +
"%s"
)
RESULT
=(
`
aws sts assume-role
--role-arn
$ROLE_ARN
\
--role-session-name
$SESSIONID
\
--query
'[Credentials.AccessKeyId,Credentials.SecretAccessKey,Credentials.SessionToken]'
\
--output
text
`
)
export
AWS_ACCESS_KEY_ID
=
${
RESULT
[0]
}
export
AWS_SECRET_ACCESS_KEY
=
${
RESULT
[1]
}
export
AWS_SECURITY_TOKEN
=
${
RESULT
[2]
}
export
AWS_SESSION_TOKEN
=
${
AWS_SECURITY_TOKEN
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment