From 473cb2144058d02ace3a1c6e5f671bc0a54cfc43 Mon Sep 17 00:00:00 2001 From: Tanner Lewis Date: Tue, 3 Sep 2024 10:31:18 -0500 Subject: [PATCH] Remove unnecessary assumeRole script Signed-off-by: Tanner Lewis --- .../assumeRole.sh | 27 ------------------- test/assumeRole.sh | 27 ------------------- 2 files changed, 54 deletions(-) delete mode 100755 deployment/cdk/opensearch-service-migration/assumeRole.sh delete mode 100755 test/assumeRole.sh diff --git a/deployment/cdk/opensearch-service-migration/assumeRole.sh b/deployment/cdk/opensearch-service-migration/assumeRole.sh deleted file mode 100755 index c02667b02..000000000 --- a/deployment/cdk/opensearch-service-migration/assumeRole.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Check if the required argument is provided -if [ "$#" -ne 2 ]; then - echo "Usage: $0 " - exit 1 -fi - -ROLE_ARN=$1 -SESSION_NAME=$2 - -# Use AWS CLI to assume the role and capture the output -assume_role_output=$(aws sts assume-role --role-arn "$ROLE_ARN" --role-session-name "$SESSION_NAME") - -# Check if the assume-role command was successful -if [ $? -ne 0 ]; then - echo "Failed to assume role" - exit 1 -fi - -# Extract the temporary credentials from the JSON output -export AWS_ACCESS_KEY_ID=$(echo $assume_role_output | jq -r '.Credentials.AccessKeyId') -export AWS_SECRET_ACCESS_KEY=$(echo $assume_role_output | jq -r '.Credentials.SecretAccessKey') -export AWS_SESSION_TOKEN=$(echo $assume_role_output | jq -r '.Credentials.SessionToken') - -echo "AWS credentials have been set for the assumed role" - diff --git a/test/assumeRole.sh b/test/assumeRole.sh deleted file mode 100755 index c02667b02..000000000 --- a/test/assumeRole.sh +++ /dev/null @@ -1,27 +0,0 @@ -#!/bin/bash - -# Check if the required argument is provided -if [ "$#" -ne 2 ]; then - echo "Usage: $0 " - exit 1 -fi - -ROLE_ARN=$1 -SESSION_NAME=$2 - -# Use AWS CLI to assume the role and capture the output -assume_role_output=$(aws sts assume-role --role-arn "$ROLE_ARN" --role-session-name "$SESSION_NAME") - -# Check if the assume-role command was successful -if [ $? -ne 0 ]; then - echo "Failed to assume role" - exit 1 -fi - -# Extract the temporary credentials from the JSON output -export AWS_ACCESS_KEY_ID=$(echo $assume_role_output | jq -r '.Credentials.AccessKeyId') -export AWS_SECRET_ACCESS_KEY=$(echo $assume_role_output | jq -r '.Credentials.SecretAccessKey') -export AWS_SESSION_TOKEN=$(echo $assume_role_output | jq -r '.Credentials.SessionToken') - -echo "AWS credentials have been set for the assumed role" -