Skip to content

Instantly share code, notes, and snippets.

@nitrocode
Created June 26, 2022 14:38
Show Gist options
  • Select an option

  • Save nitrocode/86d733e0abfd0f1adee8932420ef4120 to your computer and use it in GitHub Desktop.

Select an option

Save nitrocode/86d733e0abfd0f1adee8932420ef4120 to your computer and use it in GitHub Desktop.
Leapp cli to add sessions
#!/bin/bash
# SAML IDP ARN to use to authenticate
export LEAPP_IDP_ARN=""
# The IAM role to assume
export LEAPP_ROLE_ARN=""
# The default profile name
export LEAPP_PROFILE_NAME=""
# Both the session name and the role session name
export LEAPP_PROFILE_ALIAS=""
# The region of the saml connection
export LEAPP_REGION=""
# This creates the profile name if it doesn't exist and always returns true
# The next line will create the session
leapp profile create --profileName $LEAPP_PROFILE_NAME || true \
&& leapp session add \
--providerType "aws" \
--sessionType "awsIamRoleFederated" \
--sessionName $LEAPP_PROFILE_ALIAS \
--roleSessionName $LEAPP_PROFILE_ALIAS \
--region $LEAPP_REGION \
--roleArn $LEAPP_ROLE_ARN \
--idpUrl $LEAPP_IDP_URL \
--idpArn $LEAPP_IDP_ARN \
--profileId $(leapp profile list -x | grep $LEAPP_PROFILE_NAME | awk '{ print $1 }' | head -1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment