rkoval / alfred-aws-console-services-workflow

A powerful workflow for quickly opening up AWS Console Services in your browser or searching for entities within them.
MIT License
312 stars 54 forks source link

Support @profile in the console URL #61

Open erstaples opened 1 year ago

erstaples commented 1 year ago

Current functionality

I invoke the workflow with aws @sandbox apigateway apis, @sandbox is ignored, and the console is opened to whichever profile I currently have open in the console session.

Proposed functionality

I invoke the workflow with aws @sandbox apigateway apis and I'm taken to https://signin.aws.amazon.com/switchrole with the fields pre-populated based on the profile's settings using URL params, with the redirect_uri set to the target URI.

https://github.com/tilfinltd/aws-extend-switch-roles is a good example of this in practice.

Example

I have a sandbox profile defined in ~/.aws/config:

[profile sandbox]
role_arn = arn:aws:iam::123456789012:role/AdminRole
region = us-east-1
source_profile = default

Invoke the workflow with aws @sandbox apigateway apis:

Current: https://us-east-1.console.aws.amazon.com/apigateway/main/apis?region=us-east-1

Proposed: https://signin.aws.amazon.com/switchrole?account=123456789012&roleName=AdminRole&displayName=sandbox&src=nav&redirect_uri=https%3A%2F%2Fus-east-1.console.aws.amazon.com%2Fapigateway%2Fmain%2Fapis%3Fregion%3Dus-east-1