Repository navigation
Description
Upstream dependencies
Keep this issue open until the relevant upstream changes are available, any required StackQL integration is complete, and the acceptance checks here pass. Upstream issue closure alone is not sufficient.
Feature Description
Implement AWS AssumeRole support within StackQL to enable secure, role-based access to multiple AWS accounts without requiring static AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY. This feature should facilitate dynamic switching between accounts using Role ARN and External ID, similar to how CloudQuery supports multi-account access as documented here.
Example(s)
In my current workflow, accessing multiple AWS accounts requires manual manipulation of environment variables for each account's credentials, leading to increased complexity and potential security risks. For example, when working with different AWS accounts for development and production environments, it becomes cumbersome to switch credentials and manage access securely. Additionally, I am working on a project that involves automating various queries across different AWS accounts using StackQL. The lack of AssumeRole support complicates this automation, as it requires handling multiple sets of credentials and limits the scalability of the system.
Possible Approaches or Libraries to Consider
- Modify the NewAwsSignTransport method to optionally accept Role ARN and External ID, creating a temporary session with assumed role credentials.
- Consider using the AWS Go SDK's sts package to implement the AssumeRole call, which can be integrated into the existing AWS sign-in flow in StackQL.
- Draw inspiration from CloudQuery's implementation of AWS plugin multi-account management, adapting its approach to fit the architectural needs of StackQL.
Additional context
Adding this feature would significantly simplify the management of AWS resources across multiple accounts, especially in scenarios involving frequent switches between development, staging, and production environments. This aligns with AWS best practices for security and account management, ensuring minimal privilege access and role delegation. This enhancement would greatly benefit my ongoing project, which aims to automate StackQL-based queries across various AWS accounts, improving operational efficiency and security.
Docs
- Securely Using External ID for Accessing AWS Accounts Owned by Others
- Specific Accounts Doc in CloudQuery AWS plugin
- For reference, the source code of CloudQuery's AWS Source Plugin project before changing it to private.
Activity
jeffreyaven commentedon Aug 21, 2024
Hi @melihemreguler, We support short lived creds now using
AWS_SESSION_TOKEN, here is an example:this is used in
stackql-aws-cloud-shell.shwhich is included with thelinuxrelease (intended to use in the cloud shells, see this blog using-stackql-in-native-cloud-shells-in-aws-azure-and-gcp, this allows for:this is in the product now, in the function you referenced in aws_sign.go, is this what you were referring to?