C3W2 Graded Programming Assignment 2 Cannot Connect to Jupyter Lab

Hi

I try to do the “Graded Programming Assignment 2” in C3W2, and I failed to connect to the jupyter lab with provided URL.

Also, I faced the following error when I tried to re-do the source command:

Error:

Unable to locate credentials. You can configure credentials by running "aws configure".

I tried to delete the cloud9 environment and create a new one. I got the following output when executing source command.

voclabs:~/environment $  source scripts/setup_jupyter_env.sh


An error occurred (InvalidParameterValue) when calling the AssociateIamInstanceProfile operation: Value (LabEC2InstanceProfile) for parameter iamInstanceProfile.name is invalid. Invalid IAM Instance Profile name
===> ASSOCIATING NEW INSTANCE PROFILE TO LAB EC2 INSTANCE <===
    
    associating LabEC2InstanceProfile... ... ...
    
===> VERYFYING ASSOCIATION <===



============================> DISABLING AUTOMATIC CREDENTIALS MANAGEMENT <=============================================================================



Unable to locate credentials. You can configure credentials by running "aws configure".

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

aws: error: argument --group-id: expected one argument

Security group modified properly: 

Last metadata expiration check: 0:00:33 ago on Sat Sep 21 08:11:56 2024.
Package dnf-utils-4.3.0-13.amzn2023.0.4.noarch is already installed.
Dependencies resolved.
Nothing to do.
Complete!
Adding repo from: https://rpm.releases.hashicorp.com/AmazonLinux/hashicorp.repo
Hashicorp Stable - x86_64                                                                                                                                                                                                                                                                                                                                                                                                            10 MB/s | 1.4 MB     00:00    
Dependencies resolved.
====================================================================================================================================================================================================================================================================================================================================================================================================================================================================
 Package                                                                                                         Architecture                                                                                                 Version                                                                                                         Repository                                                                                                       Size
====================================================================================================================================================================================================================================================================================================================================================================================================================================================================
Installing:
 terraform                                                                                                       x86_64                                                                                                       1.9.6-1                                                                                                         hashicorp                                                                                                        27 M

Transaction Summary
====================================================================================================================================================================================================================================================================================================================================================================================================================================================================
Install  1 Package

Total download size: 27 M
Installed size: 85 M
Downloading Packages:
terraform-1.9.6-1.x86_64.rpm                                                                                                                                                                                                                                                                                                                                                                                                         52 MB/s |  27 MB     00:00    
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                                                                                                                                                                                                                                                                                51 MB/s |  27 MB     00:00     
Hashicorp Stable - x86_64                                                                                                                                                                                                                                                                                                                                                                                                            43 kB/s | 3.9 kB     00:00    
Importing GPG key 0xA621E701:
 Userid     : "HashiCorp Security (HashiCorp Package Signing) <security+packaging@hashicorp.com>"
 Fingerprint: 798A EC65 4E5C 1542 8C8E 42EE AA16 FCBC A621 E701
 From       : https://rpm.releases.hashicorp.com/gpg
Key imported successfully
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                                                                                                                                                                                                                                                                            1/1 
  Installing       : terraform-1.9.6-1.x86_64                                                                                                                                                                                                                                                                                                                                                                                                                   1/1 
  Verifying        : terraform-1.9.6-1.x86_64                                                                                                                                                                                                                                                                                                                                                                                                                   1/1 

Installed:
  terraform-1.9.6-1.x86_64                                                                                                                                                                                                                                                                                                                                                                                                                                          

Complete!
Terraform has been installed

Unable to locate credentials. You can configure credentials by running "aws configure".

Unable to locate credentials. You can configure credentials by running "aws configure".

Unable to locate credentials. You can configure credentials by running "aws configure".

Unable to locate credentials. You can configure credentials by running "aws configure".

Unable to locate credentials. You can configure credentials by running "aws configure".

Unable to locate credentials. You can configure credentials by running "aws configure".
Requirement already satisfied: pip in ./jupyterlab-venv/lib/python3.9/site-packages (21.3.1)

The link to the jupyter lab still provided even through the source command execute with errors.

I replaced every Name=LabEC2InstanceProfile in the setup_jupyter_env.sh file with Name=Cloud9EC2InstanceProfile then problem solved.

Cool! Let me try it.

1 Like

Hi,

After the change, I can connect to the jupyter lab, thanks a lot.

But there exist further problem when I try to run the code:

I came across a similar problem once, but when I tried it again next day the problem is gone. I only did the same change in the setup_jupyter_env.sh file.

Maybe you can try restart AWS?

It seems the problem has been resolved. I created a new environment and a jupyter lab environment can now be launched w/o error.

I had the same problem accessing the Jupyter notebook server running in the Cloud9 EC2 instance. In the end, I managed to access the server by replacing the “Public IPv4 DNS” portion of the URL link with the “Public IPv4 address” of the EC2 instance. This information can be found in the EC2 instances dashboard.

1 Like