Generate Aws_access_key_id And Aws_secret_access_key

/ Comments off
aws-temp-token.sh

Generate Aws_access_key_id And Aws_secret_access_key Password

#!/bin/bash
#
# Sample for getting temp session token from AWS STS
#
# aws --profile youriamuser sts get-session-token --duration 3600
# --serial-number arn:aws:iam::012345678901:mfa/user --token-code 012345
#
# Based on : https://github.com/EvidentSecurity/MFAonCLI/blob/master/aws-temp-token.sh
#
AWS_CLI=`which aws`
if [ $?-ne 0 ];then
echo'AWS CLI is not installed; exiting'
exit 1
else
echo'Using AWS CLI found at $AWS_CLI'
fi
if [ $#-ne 1 ];then
echo'Usage: $0 <MFA_TOKEN_CODE>'
echo'Where:'
echo' <MFA_TOKEN_CODE> = Code from virtual MFA device'
exit 2
fi
AWS_USER_PROFILE=userName
AWS_2AUTH_PROFILE=2auth
ARN_OF_MFA=GAKTxxxxxxxxxx
MFA_TOKEN_CODE=$1
DURATION=129600
echo'AWS-CLI Profile: $AWS_CLI_PROFILE'
echo'MFA ARN: $ARN_OF_MFA'
echo'MFA Token Code: $MFA_TOKEN_CODE'
set -x
read AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY AWS_SESSION_TOKEN <<<
$( aws --profile $AWS_USER_PROFILE sts get-session-token
--duration $DURATION
--serial-number $ARN_OF_MFA
--token-code $MFA_TOKEN_CODE
--output text awk '{ print $2, $4, $5 }')
echo 'AWS_ACCESS_KEY_ID: ' $AWS_ACCESS_KEY_ID
echo 'AWS_SECRET_ACCESS_KEY: ' $AWS_SECRET_ACCESS_KEY
echo 'AWS_SESSION_TOKEN: ' $AWS_SESSION_TOKEN
if [ -z '$AWS_ACCESS_KEY_ID' ]
then
exit 1
fi
`aws --profile $AWS_2AUTH_PROFILE configure set aws_access_key_id '$AWS_ACCESS_KEY_ID'`
`aws --profile $AWS_2AUTH_PROFILE configure set aws_secret_access_key '$AWS_SECRET_ACCESS_KEY'`
`aws --profile $AWS_2AUTH_PROFILE configure set aws_session_token '$AWS_SESSION_TOKEN'`
  1. Access Keys are used to sign the requests you send to Amazon S3. Like the Username/Password pair you use to access your AWS Management Console, Access Key Id and Secret Access Key are used for programmatic (API) access to AWS services. You can manage your Access Keys in AWS Management Console.
  2. In order to get your Access Key ID and Secret Access Key follow next steps: Open the IAM console. From the navigation menu, click Users. Select your IAM user name. Click User Actions, and then click Manage Access Keys. Click Create Access Key. Your keys will look something like this: Access key ID example: AKIAIOSFODNN7EXAMPLE.
config

How to get your AWS Access Key and AWS Secret Access Key. What you need to know to get started with AWS. Amazon Web Services (AWS) is a market leader in Cloud Storage, so know you are safe making the Cloud Platform transition with them.

Create Aws_access_key_id Aws_secret_access_key

credentials
~/.aws/credentials
[userName]
aws_access_key_id: AxxxxxxxxxxxxxxxxxQ
aws_secret_access_key: hxxxxxxxxxxxxxxxxxx4
[2auth]
aws_access_key_id = AxxxxxxxxxxxxxxxxxA
aws_secret_access_key = pxxxxxxxxxxxxxxxxxxxxxy
aws_session_token = AxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxF

Generate Aws_access_key_id And Aws_secret_access_key Free

usage

Generate Aws_access_key_id And Aws_secret_access_key Text

Sign up for freeto join this conversation on GitHub. Already have an account? Sign in to comment