Skip to content

Instantly share code, notes, and snippets.

@stevecaldwell77
Created June 24, 2016 17:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stevecaldwell77/69f173a9426f34446e549e20658de0a7 to your computer and use it in GitHub Desktop.
Save stevecaldwell77/69f173a9426f34446e549e20658de0a7 to your computer and use it in GitHub Desktop.
cat <<EOM > /tmp/assume-role-policy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": [
"redshift.amazonaws.com"
]
},
"Action": [
"sts:AssumeRole"
]
}
]
}
EOM
role1_arn=$(
aws iam create-role \
--role-name test_role_1 \
--assume-role-policy-document file:///tmp/assume-role-policy.json |
jq -r '.Role.Arn'
)
role2_arn=$(
aws iam create-role \
--role-name test_role_2 \
--path '/mypath/' \
--assume-role-policy-document file:///tmp/assume-role-policy.json |
jq -r '.Role.Arn'
)
# This produces:
# An error occurred (InvalidParameterValue) when calling the CreateCluster
# operation: Invalid IAM Role ARN format:
# arn:aws:iam::[REDACTED]:role/mypath/test_role_2
aws redshift create-cluster \
--cluster-identifier my-test-cluster \
--cluster-type single-node \
--node-type dc1.large \
--master-username test \
--master-user-password Test0123 \
--iam-roles "$role2_arn"
# This succeeds:
aws redshift create-cluster \
--cluster-identifier my-test-cluster \
--cluster-type single-node \
--node-type dc1.large \
--master-username test \
--master-user-password Test0123 \
--iam-roles "$role1_arn"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment