Skip to content

Commit 0484df9

Browse files
authored
Updated Cognito Identity CLI Command Format
Replaced outdated key=value syntax with JSON-based in "--logins" format, keeping the old format for preserved legacy.
1 parent 58b10eb commit 0484df9

File tree

1 file changed

+25
-11
lines changed

1 file changed

+25
-11
lines changed

src/pentesting-cloud/aws-security/aws-services/aws-cognito-enum/cognito-identity-pools.md

Lines changed: 25 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -167,22 +167,36 @@ For this you might need to have access to the **identity provider**. If that is
167167
168168
Anyway, the **following example** expects that you have already logged in inside a **Cognito User Pool** used to access the Identity Pool (don't forget that other types of identity providers could also be configured).
169169

170-
<pre class="language-bash"><code class="lang-bash">aws cognito-identity get-id \
171-
--identity-pool-id <identity_pool_id> \
172-
--logins cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>=<ID_TOKEN>
170+
<pre class="language-bash"><code class="lang-bash">
171+
# Updated format
172+
aws cognito-identity get-id \
173+
--identity-pool-id <identity_pool_id> \
174+
--logins '{"cognito-idp.<region>.amazonaws.com/<user_pool_id>": "<ID_TOKEN>"}'
173175

174-
# Get the identity_id from the previous commnad response
175176
aws cognito-identity get-credentials-for-identity \
176-
--identity-id <identity_id> \
177-
--logins cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>=<ID_TOKEN>
177+
--identity-id <identity_id> \
178+
--logins '{"cognito-idp.<region>.amazonaws.com/<user_pool_id>": "<ID_TOKEN>"}'
178179

180+
aws cognito-identity get-credentials-for-identity \
181+
--identity-id <identity_id> \
182+
--custom-role-arn <role_arn> \
183+
--logins '{"cognito-idp.<region>.amazonaws.com/<user_pool_id>": "<ID_TOKEN>"}'
184+
</code></pre>
185+
186+
> **Deprecated format** — these may no longer work with current AWS CLI:
187+
<pre class="language-bash"><code class="lang-bash">
188+
aws cognito-identity get-id \
189+
--identity-pool-id <identity_pool_id> \
190+
--logins cognito-idp.<region>.amazonaws.com/<user_pool_id>=<ID_TOKEN>
191+
192+
aws cognito-identity get-credentials-for-identity \
193+
--identity-id <identity_id> \
194+
--logins cognito-idp.<region>.amazonaws.com/<user_pool_id>=<ID_TOKEN>
179195

180-
# In the IdToken you can find roles a user has access because of User Pool Groups
181-
# User the --custom-role-arn to get credentials to a specific role
182196
aws cognito-identity get-credentials-for-identity \
183-
--identity-id <identity_id> \
184-
<strong> --custom-role-arn <role_arn> \
185-
</strong> --logins cognito-idp.<region>.amazonaws.com/<YOUR_USER_POOL_ID>=<ID_TOKEN>
197+
--identity-id <identity_id> \
198+
--custom-role-arn <role_arn> \
199+
--logins cognito-idp.<region>.amazonaws.com/<user_pool_id>=<ID_TOKEN>
186200
</code></pre>
187201

188202
> [!WARNING]

0 commit comments

Comments
 (0)