-
Notifications
You must be signed in to change notification settings - Fork 12
Support Role profile with SSO profile as a source profile. #9
Comments
Hi @MarcinKasprowicz - Thanks for taking the time to fill in the issue and write a pull request. I'm a little bit unsure of the use case? As far as I can see this is quite a non-standard way of authenticating (I'm not sure the aws-cli or aws-sdk would support this config?). The built-in AWS SSO already works with organisations to allow cross account access with a single SSO sign-in url; which is what I use to authenticate across multiple accounts. This has the added advantage that the credentials can be refreshed directly if you do something which outlasts the sso/role assumption timeouts. For example: [profile payment-suite-pro]
sso_start_url = https://xxx.awsapps.com/start
sso_region = eu-north-1
sso_account_id = 99999999999
sso_role_name = FullAccess
[profile spt-payment-dev]
sso_start_url = https://xxx.awsapps.com/start
sso_region = eu-north-1
sso_account_id = 111111111
sso_role_name = AssumableAdmin There's some more information in this documentation section: https://docs.aws.amazon.com/singlesignon/latest/userguide/manage-your-accounts.html I'd love to understand the reason you're using this approach of manually assuming the role (instead of using SSO + organisations) and whether it's something you've found supported elsewhere before taking on this additional feature. |
Thanks for asking those questions, I could take a look one more time at our approach and validate it 🧐. I realized that we could try to update the trust relationship of In our setup, I wanted to have one entry point to our accounts. That entry point is the bastion account. This flow works brilliantly with Terraform (and assume role capability https://learn.hashicorp.com/tutorials/terraform/aws-assumerole)
There is also one subtle thing that is pretty nice. You can switch between accounts using Role history by less clicks than with AWS SSO. With the current state of Serverless (without the plugin) we need to do something like
With the change that I proposed:
I think that I would be able to solve my problem by updating the trust relationship in AssumableAdmin... I will try to do it. Does aws-cli or aws-sdk support the flow that I have mentioned? Yes it does.
|
Sorry it’s taking awhile to get back to you on this. I’m reluctant to bake in a company-specific authentication flow. Especially one that is a custom version of what AWS supports natively. So I want to do a bit of testing to see how the aws-sdk-js is handling this itself. The plugin should be using all the same ini file source profile resolution that the aws-sdk does, and so, if everything is just working natively for you, then that might be the heart of this bug. It is surprising how many workarounds have their origins in ‘because central IT…’.. At a glance, at least, it does seem like you’re rolling your own version of the the AWS IAM Identity Centre + AWS Organisations feature set; a centralised login that gives you access, via controlled role assumption, into organisation accounts. I don’t know if you appreciated that the Last resort - AWS does provide an escape hatch for people using company-specific approaches with the |
Adding a +1 on this request as we've hit the same issue while we are migrating to SSO (with what looks like exactly the same approach). So we would ideally like the functionality as outlined in this enhancement to be able to seamlessly work with serverless and SSO. |
That's good to know @RealityCtrl . I'd love to know (for my own interest) why you're not using AWS' IAM Identity Centre to solve this problem and, instead, rolling your own with bastion + roles? Central IT again? Nevertheless, it does prove out that people are going to do this. I actually think the fix is not a separate, specialist, flow (as currently implemented in the PR), but to fix the bug that the |
It's down to a centralised cloud engineering team that owns the setup of commonalities like AWS accounts, VPCs etc. There is probably the historical context of how the AWS accounts were setup in the company when AWS was fairly new. All I can say is right now there is a user that can log into a base account and then jump to a role in the same of other accounts. It seems like this is being replicated somewhat with single sign on. |
Hey @thomasmichaelwallace Thank you very much for this project. It got me off the ground. FWIW I am also running into this limitation and I'm woring to get deeper. TL;DR: the v3@aws-sdk iniFile loader looks like it should work (for this and Use Case admin's
CICD:
Do you have an issue ref for the |
Hey @erikerikson ! So here's my take:
So... where does that leave us? Probably the solution is:
But it's probably not something that's going to get done in the short term. |
Oh man, I didn't mean to ask for such a reply. Thank you very much, its incredibly useful. Oddly, that config comes from a very recent "latest" awscli install. Thank you for the CDK recommendation. I've been previously warned off of it but I've also hit a fairly large set of barriers in the framework. I would definitely miss the variable system... /hrmm Above these, thank you so much for the analysis as well as the clear understanding of your incentives. Sounds like I have some empowered decision making to do next :D Thank you for your kindness and all the best! |
No worries - It was helpful getting everything down in a (semi) structured way; and give everyone waiting on this issue a bit more context 😄 |
pardon for my confusion but does this plugin works with AWS JS SDK v3 (either on node 16 or 18 runtime)? I've been trying to migrate to aws js sdk v3 with no luck |
@deathemperor this plugin isn't written using v3. However it is fine for the version your tooling (i.e. serverless framework) is using and the version you lambda functions are using to be different. You can install v2 and v3 side-by-side (although I expect the serverless framework would have installed v2 automatically): npm install --dev aws-sdk # now your tooling can use v2
npm install @aws-sdk/client-s3 # now your code can use v3 |
@thomasmichaelwallace all my tooling works just fine, it's just that when deployed using any sdk module throws |
@deathemperor - I've moved this discussion to a new issue #20 - as it is unrelated to SSO - let's continue to discussion there. |
Please any update about this issue? It's been one and half year until creation. Our company is forcing us to use this approach as well and we had to invent crazy workarounds on our side to deal with sso login using one role and then switching to another role. When using AWS CLI, this approach is natively supported and when reading comments above, seems like this approach is very popular in corporates. Solving this issue on plugin side to behave like native AWS CLI will solve our pain. Thanks for understanding. |
Serverless will support this in V4 it seems serverless/serverless#7567 (comment) |
Is your feature request related to a problem? Please describe.
The following scenario isn't covered by the plugin
Current behaviour
Describe the solution you'd like
The text was updated successfully, but these errors were encountered: