AWS CLI - Auto Click "Allow Access"

Automatically clicks the "Allow Access" button when it becomes available.

Author
vivasvan-patel-ev
Daily installs
0
Total installs
1
Ratings
0 0 0
Version
2025-03-04
Created
2025-03-04
Updated
2025-03-04
Size
1.31 KB
License
MIT
Applies to

AWS CLI - Auto Click "Allow Access" (Tampermonkey Script)

Description

This Tampermonkey script automates the clicking of the "Allow Access" button when accessing AWS CLI through the AWS web portal. It is specifically designed for the AWS WorkSpaces or CLI login pages where the "Allow Access" button needs to be clicked for access.

Features

  • Auto-clicks the "Allow Access" button ([data-testid="allow-access-button"]) as soon as it becomes available.
  • Uses a MutationObserver to detect changes in the DOM and trigger the click event.
  • Closes the tab automatically after clicking the button (with a 2-second delay).
  • Runs automatically when the page is loaded (@run-at document-idle).

How It Works

  1. Detects the Button: The script looks for the "Allow Access" button on the AWS authentication page.
  2. Clicks the Button Automatically: Once the button is found, it clicks the button to allow access.
  3. Monitors DOM Changes: The script continuously checks for the button's appearance using a MutationObserver, ensuring it clicks the button as soon as it's available.
  4. Closes the Tab: After a short delay, the tab is automatically closed to prevent unnecessary open pages.
  5. Runs at Idle State: The script starts when the page is fully loaded, ensuring efficient execution.

Installation Instructions

  1. Install Tampermonkey for your browser.
  2. Click on the Tampermonkey extension icon and select "Create a new script".
  3. Delete the default code and paste the script provided.
  4. Save the script and enable it.
  5. Navigate to the AWS CLI login page (https://d-9a67274801.awsapps.com/start/), and the script will automatically handle the confirmation process.

Supported URLs

Permissions

  • No additional permissions are required (@grant none).
  • Runs only on the specified AWS domain (@match is restricted to AWS CLI login pages).

Troubleshooting

  • If the script does not work:
    • Ensure Tampermonkey is installed and the script is enabled.
    • Verify that the button selector ([data-testid="allow-access-button"]) is still correct (AWS may update its UI).
    • Refresh the page after enabling the script.

Notes

  • This script does not store or send any user data.
  • If AWS changes its page structure or button ID, the script may require an update.

License

This script is provided under the MIT License.


🚀 Enjoy hassle-free AWS CLI access!