iTranslated by AI
re:Invent 2025: New Feature to Programmatically Access AWS with Console Credentials
Introduction
By transcribing various overseas lectures into Japanese articles, we aim to make hidden, high-quality information more accessible. This project features the following presentation!
For transcriptions of re:Invent 2025 articles, please refer to this Spreadsheet. Please check it out as well.
📖 re:Invent 2025: AWS re:Invent 2025 - Programmatically access AWS with your console credentials (SEC354)
In this session, Ram Maharajaparam, Senior Manager of Software Development at AWS IAM, and Khaled Sinno, Principal Engineer at AWS IAM, introduce new features for programmatic access to AWS using console credentials. The
aws logincommand allows you to use the same credentials used to log into the AWS console from the command line, eliminating the need to create long-term credentials. It is revealed that approximately two-thirds of cases handled by the AWS Security Incident Response team are caused by unauthorized access due to long-term credentials. The process is secure, using the OAuth 2 authorization code flow with PKCE; credentials are valid for 15 minutes, automatically refreshed in the background, and can be used for up to 12 hours. The feature supports 11 AWS SDKs and various programming languages, and the live demo showcased the entire process from creating an IAM user and setting up MFA to actual login.
Note: This article was automatically generated while maintaining the content of the original lecture as much as possible. Please be aware that there may be typos or incorrect content.
Main Content
The Arrival of AWS Login: Enabling Programmatic Access with Console Credentials
Before we begin, let me ask you a few quick questions. Think back to when you first created an AWS account. How many of you here have actually used separate methods for programmatic access and logging into the AWS console? I see a few hands. Understood—there is definitely friction and fragmentation here. When creating and managing programmatic access keys for AWS from your local development environment, how did you do it? I see. Did you find that process simple? Understood.
So, you are in the perfect place to learn how to make this process secure and simple. Often, developers experience a trade-off where being secure isn't necessarily simple, but we are here to talk about our latest launch: the ability to programmatically access AWS using console credentials. My name is Ram Maharajaparam. I am a Senior Manager of Software Development for AWS IAM. And with me today is Khaled Sinno. He is a Principal Engineer for AWS IAM.
We have spoken with many customers like you, and the theme we constantly hear is very similar to the questions I asked earlier. So, we asked ourselves: what can we do to eliminate this complexity? For customers new to AWS, what can we do to make the secure path the easy path from the start? And for existing customers like you who use long-term credentials for programmatic access, how can we help you transition to short-term credentials and align with security best practices?
So, what did we build? And when we started asking these questions, it basically led to the creation of aws login. When you type aws login into your favorite terminal application, you can use the same credentials you use to log into the AWS console for programmatic access from the command line. This means you don't need to create new identities, and you no longer need access keys for local development.
So, what happens when you run this? The first time you run it, you'll be asked which AWS region you'd like to use. Obviously, there are 38 regions at the moment. And the CLI opens your default browser; if you are already signed in to the AWS Management Console, it remembers that, generates temporary security credentials based on it, and securely delivers them to your terminal application. If you aren't logged in, you'll be able to authenticate at that point.
You'll be able to use multi-factor authentication (MFA). We support a wide range of MFA options, and we use the resulting session as a bridge, so to speak, to short-term credentials. Now, you might be thinking, "I develop on a headless Linux VM; how do I open a browser in that case?" Don't worry. We actually have a remote option. Therefore, you can securely deliver these credentials through a cross-device authentication workflow.
Now, all of this raises one question: how is this secure? The most obvious is that you no longer need to create, manage, or store long-term credentials. As an interesting fact, about two-thirds of the cases handled by the AWS Security Incident Response team start with unauthorized access resulting from a third party obtaining long-term credentials. So, we strongly recommend switching to short-term credentials, but that's not all. Actually, there's a bit more mechanism under the hood.
What we are using here is the OAuth 2 authorization code flow. This uses something called PKCE, which stands for Proof Key for Code Exchange. This protects you against interception attacks.
We also ensure that these tokens are short-lived, but—oops, I've advanced the slide. We also manage the tokens. Even though they are short-lived, we can keep them valid for up to 12 hours by refreshing them in the background. We also have encryption mechanisms in place to make it difficult to steal these credentials from one device to another.
It is also designed to be very easy to get started. Just download the latest AWS CLI and type aws login, and you can start using it immediately. It also helps improve productivity. I've talked a lot about the CLI so far, but this isn't just about CLI access. These credentials can be used from any of the 11 AWS SDKs we support and various programming languages. For example, if you are running Kiro and writing a Python script used to access multiple AWS services, that Python SDK can also use the same credentials to authenticate to those services, so you don't necessarily need to create new credentials at that point.
Once you've finished building your script, this provides a path to easily deploy them to AWS. Whether you are deploying to an AWS EC2 instance using an instance role, or deploying to Lambda using an execution role, it's possible. All of these use short-term credentials and realize a very seamless transition. Khaled will take the brave challenge of actually demonstrating for you how this works in a live demo. So, everyone, let's pray to the demo gods and hope the Wi-Fi remains stable.
Demonstration of the AWS Login CLI: Secure Transition from Root to IAM User
Thanks, Ram. Hello, everyone. The best way to talk about this feature is to actually show it to you. So, I'm going to demonstrate this feature. Let's switch to the demo. Now, to start using the AWS Login CLI, you first need to upgrade your CLI to have this feature. For example, if you are using a Mac like me, you can run brew upgrade AWS CLI. You need version 2.32.9 or higher. With this version, you will be able to use the AWS Login CLI.
If you haven't installed the AWS CLI yet, you can visit this documentation page. It shows installation methods for Windows, Linux, and Mac. Now, once you've upgraded the CLI, you can run aws login. What aws login does is open a browser and display the currently logged-in session. Let's imagine a scenario where you've just created an AWS account. By default, you are automatically logged in as root, and the session is active. Go to the terminal, and as you see here, when you run aws login, the available sessions in your browser are automatically listed. Select the session, and you can see that the profile has been automatically updated to use this console login.
If you run aws sts get-caller-identity here, you will see that the account being referred to is this account you just logged into, and that it is root. Now, imagine you went to get coffee after creating the account. A very long coffee break—more than 12 hours. Your credentials will expire, right? Let's simulate that. First, let's go here. Run the console. Let's simulate by logging out of the session and run aws logout. Let's start over. Run aws login.
The browser pops up again, but this time nothing is displayed to sign in, right? This means you need to sign in with root or an IAM user. Click Refresh. There is nothing available here. Click "Continue with root and IAM user." Now, in this case, I will log in as root. Because that's what you have after creating an account, right?
Select the account. Click Next. I will enter the correct code. And the password. When you click Sign In, you will be prompted for an MFA code. That's because all root access requires an MFA code. So now, I'll enter the MFA code and sign in. You can confirm here that the profile has been updated to this one.
Now, if you run aws sts get-caller-identity, you can confirm that you are logged in as root for that account. Fantastic. Now that access is established, we should move away from root. Working as root is not a best practice. You should always work with least privilege. So, from now on, I will go to the logged-in console and create an IAM user dedicated to the AWS login CLI.
Go to IAM, and create an IAM user here. User, create user, and let's name it, say, demo-user. Yes, I'll enter a password I can remember. Click Next and attach a policy. In this case, to keep it simple, let's select Administrator Access. Next, and create the user.
Now, next, as a best practice, we recommend adding MFA to the user to ensure security. So, let's enable MFA. In this case, it's the easiest way, so I will use a passkey. I'll name it "My Work MacBook". Click Next, continue. Using fingerprint authentication, it's created.
Now, let's go back to the CLI. Log out, clear, and run aws login. Yes, it still remembers the root user. I don't want to use the root user, so in this case, I will sign in to a new session. In this case, I'll log in with this account, demo-user. I won't share the password with you all. Now, I'm prompted for MFA or a passkey.
I'm logged in. And now, it asks, "Do you want to overwrite the saved root credentials with demo-user?" I answer Yes. So now, let's confirm that these credentials are being used. Run get-caller-identity, and demo-user should be displayed. And it's displayed here. Yes. With this, we can now safely use the AWS Login CLI without storing static credentials anywhere. These are 15-minute credentials, which are automatically refreshed in the background and will automatically expire in 12 hours. This is the secure way to access the CLI from now on.
Granular Access Control and Principle of Least Privilege: IAM User and MFA Best Practices
Wow, thank you, Khaled, thank you for the demo. So, can you actually explain? You used Administrator Access for the IAM user, but obviously, in many cases, you don't want to use Administrator Access. So, how can we use granular access for this feature? First of all, to be able to use this feature, i.e., login, you will need additional permissions. Understood. Every IAM user will need about two more permissions. I think I can show them on PowerPoint.
Is it visible? Yes, understood. Two additional permissions are required: SignInAuthorizeOAuth2Access and SignInCreateOAuth2Token. With these permissions, you can use the AWS Login CLI to obtain an access token valid for 15 minutes. That's right. Now, if you don't want to manually add these permissions to every principal, there is a managed policy. It is called SignInLocalDevelopmentAccess. Just attach that to every principal, and you can start using the AWS Login CLI.
Understood. So, does this mean it's cool to use root again? That seems like a tricky question.
You should always operate in a least-privilege manner. You see that I started with root here and immediately switched to something else. And I set up Administrator Access. In this case, that's probably not a best practice. You should probably set up read-only access or something more restricted. Always operate with least privilege. Stay away from root. Stay away from root unless absolutely necessary. This is why we launched a feature for organizations last year. This feature allows you to remove root from all member accounts in an organization, and you can temporarily assume root from the management account only when necessary. Always operate with least privilege. That is the guidance.
Understood. So, what are the recommendations regarding IAM users? Historically, we've said to avoid IAM users because they have long-term access keys, but this is changing now. As long as you don't create static credentials, which are long-term access keys, these are perfectly fine. These are very short-term credentials, shorter than a normal session, and they are automatically refreshed in the background. So, this is a very good method, but we always recommend adding MFA. Because these are humans using those credentials, please add MFA.
Well, that's almost it. As you have seen, we have actually tried to provide a secure and simple way to log into AWS using console credentials and use them for programmatic access from local development. All you need is to install the latest version of the AWS CLI, run aws login, and then start developing. Thank you, everyone. Thank you.
So, I have a few announcements. A survey will pop up in the AWS events app, so please fill out the survey. It is very helpful for us. And we will be waiting right outside the hall, so if you have any questions, we would be happy to answer them. Let's disconnect the microphones and meet there. Thank you very much. Thank you.
Note: This article was automatically created using Amazon Bedrock while maintaining the information from the original video as much as possible.







































Discussion