Skip to content

Instantly share code, notes, and snippets.

@jesse0099
jesse0099 / assume_aws_role.sh
Last active November 9, 2023 18:50
Assume aws role and set environment variables with the temporary credentials returned by sts assume-role. Clear variables option is also provided.
#!/bin/bash
# Variables
FLAG="$1"
ROLE_ARN="$2"
SESSION_NAME="$3"
# Function to reset AWS credentials
reset_credentials() {
@jesse0099
jesse0099 / assume_aws_rolel.ps1
Last active November 9, 2023 18:49
Assume aws role and set environment variables with the temporary credentials returned by sts assume-role. Clear variables option is also provided.
param (
[string]$session_name,
[string]$role_arn,
[switch]$reset_credentials
)
function AssumeRole {
param (
[string]$roleArn,
[string]$sessionName

Keybase proof

I hereby claim:

To claim this, I am signing this object: