Code Monkey home page Code Monkey logo

Comments (4)

jpcpereira avatar jpcpereira commented on May 23, 2024 1

Hi, João.

Thanks for sharing the redacted output. It's still not clear where is the issue.

Could you also check and copy the logs from the /var/log/amazon/ssm/amazon-ssm-agent.log that appear when you run the sm-ssh-ide ssm-agent command?

You can do this by opening and image terminal (the small icon with $_ sign at the toolbar) and copying the log file to the home directory with the following command:

cp /var/log/amazon/ssm/amazon-ssm-agent.log ~

Then you can open this file from a file browser and copy-paste the relevant lines here or download and attach the whole file (if possible).

Regards, Ivan

Hi @ivan-khvostishkov ,

I checked the logs as you suggested and found that there were some AccessDenied errors due to SSM permissions missing in the role that I was using. Added them and it works now, can connect from local to the instance! Thanks for the tips and looking forward to starting using this.

from sagemaker-ssh-helper.

ivan-khvostishkov avatar ivan-khvostishkov commented on May 23, 2024

Hi, João.

Thank you for the interest in the SageMaker SSH Helper!

When you run the steps in the notebook, the command sm-ssh-ide ssm-agent connects to the SSM Agent and you should keep it running (do not stop the kernel). To validate that the SageMaker Studio app has connected to SSM, go to the Systems Manager Console > Fleet Manager and check that a new managed node appeared in the list and got the “SSM Agent ping status” as Online.

When it's Online, the command sm-local-ssh-ide <<kernel_gateway_app_name>> should establish a connection successfully.

Hope it helps!

But if it's still doesn't work, please, share the output of the cell with sm-ssh-ide init-ssm command.

Regards,
Ivan

from sagemaker-ssh-helper.

jpcpereira avatar jpcpereira commented on May 23, 2024

Hi, João.

Thank you for the interest in the SageMaker SSH Helper!

When you run the steps in the notebook, the command sm-ssh-ide ssm-agent connects to the SSM Agent and you should keep it running (do not stop the kernel). To validate that the SageMaker Studio app has connected to SSM, go to the Systems Manager Console > Fleet Manager and check that a new managed node appeared in the list and got the “SSM Agent ping status” as Online.

When it's Online, the command sm-local-ssh-ide <<kernel_gateway_app_name>> should establish a connection successfully.

Hope it helps!

But if it's still doesn't work, please, share the output of the cell with sm-ssh-ide init-ssm command.

Regards, Ivan

Hi Ivan,

Thanks for the quick reply. I checked that after I run sm-ssh-ide ssm-agent the instance does not show up in Fleet Manager.
Please find below the output of sm-ssh-ide init-ssm:

Output ``` sm-ssh-ide: Will add the following tags to the managed instance: Key=SSHOwner, Value=XXXX Reading package lists... Building dependency tree... Reading state information... Suggested packages: zip The following packages will be upgraded: unzip 1 upgraded, 0 newly installed, 0 to remove and 72 not upgraded. Need to get 172 kB of archives. After this operation, 1024 B of additional disk space will be used. Get:1 http://security.debian.org/debian-security buster/updates/main amd64 unzip amd64 6.0-23+deb10u3 [172 kB] Fetched 172 kB in 0s (12.3 MB/s) (Reading database ... 61001 files and directories currently installed.) Preparing to unpack .../unzip_6.0-23+deb10u3_amd64.deb ... Unpacking unzip (6.0-23+deb10u3) over (6.0-23+deb10u2) ... Setting up unzip (6.0-23+deb10u3) ... Processing triggers for mime-support (3.62) ... Processing triggers for man-db (2.8.5-2) ... You can now run: /usr/local/bin/aws --version (Reading database ... 61001 files and directories currently installed.) Preparing to unpack /tmp/amazon-ssm-agent.deb ... Stopping agent Preparing for install Unpacking amazon-ssm-agent (3.1.1927.0-1) over (3.1.1927.0-1) ... Setting up amazon-ssm-agent (3.1.1927.0-1) ... Starting agent Error occurred fetching the seelog config file path: open /etc/amazon/ssm/seelog.xml: no such file or directory Initializing new seelog logger New Seelog Logger Creation Complete Applying config override from /etc/amazon/ssm/amazon-ssm-agent.json. 2022-11-04 15:52:39 WARN Could not read InstanceFingerprint file: InstanceFingerprint does not exist. Applying config override from /etc/amazon/ssm/amazon-ssm-agent.json. 2022-11-04 15:52:39 INFO No initial fingerprint detected, generating fingerprint file... 2022-11-04 15:52:40 INFO Successfully registered the instance with AWS SSM using Managed instance-id: mi-0c4fdec4a874d9fee Reading package lists... Building dependency tree... Reading state information... The following NEW packages will be installed: sudo 0 upgraded, 1 newly installed, 0 to remove and 72 not upgraded. Need to get 1244 kB of archives. After this operation, 3882 kB of additional disk space will be used. Get:1 http://deb.debian.org/debian buster/main amd64 sudo amd64 1.8.27-1+deb10u3 [1244 kB] Fetched 1244 kB in 0s (28.2 MB/s) Selecting previously unselected package sudo. (Reading database ... 61001 files and directories currently installed.) Preparing to unpack .../sudo_1.8.27-1+deb10u3_amd64.deb ... Unpacking sudo (1.8.27-1+deb10u3) ... Setting up sudo (1.8.27-1+deb10u3) ... invoke-rc.d: could not determine current runlevel invoke-rc.d: policy-rc.d denied execution of start. Processing triggers for man-db (2.8.5-2) ... Processing triggers for systemd (241-7~deb10u8) ... Unable to load extension: pydevd_plugins.extensions.types.pydevd_plugin_pandas_types cp: '/usr/local/bin/sm-helper-functions' and '/usr/local/bin/sm-helper-functions' are the same file cp: '/usr/local/bin/sm-connect-ssh-proxy' and '/usr/local/bin/sm-connect-ssh-proxy' are the same file cp: '/usr/local/bin/sm-wait' and '/usr/local/bin/sm-wait' are the same file cp: '/usr/local/bin/sm-start-ssh' and '/usr/local/bin/sm-start-ssh' are the same file cp: '/usr/local/bin/sm-save-env' and '/usr/local/bin/sm-save-env' are the same file cp: '/usr/local/bin/sm-init-ssm' and '/usr/local/bin/sm-init-ssm' are the same file cp: '/usr/local/bin/sm-ssh-ide' and '/usr/local/bin/sm-ssh-ide' are the same file cp: '/usr/local/bin/sm-local-start-ssh' and '/usr/local/bin/sm-local-start-ssh' are the same file cp: '/usr/local/bin/sm-local-ssh-ide' and '/usr/local/bin/sm-local-ssh-ide' are the same file cp: '/usr/local/bin/sm-local-ssh-training' and '/usr/local/bin/sm-local-ssh-training' are the same file if _is_centos; then yum install -y unzip else apt-get install -y unzip fi debconf: delaying package configuration, since apt-utils is not installed
_install_aws_cli
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 45.1M  100 45.1M    0     0   105M      0 --:--:-- --:--:-- --:--:--  104M

if _is_centos; then
  _install_ssm_agent_centos
else
  _install_ssm_agent_ubuntu
fi
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 30.5M  100 30.5M    0     0  92.9M      0 --:--:-- --:--:-- --:--:-- 92.9M

cat >/etc/amazon/ssm/amazon-ssm-agent.json <<EOF
{
    "Profile":{
        "ShareCreds" : true,
        "ShareProfile" : "ssm",
        "ForceUpdateCreds" : false,
        "KeyAutoRotateDays": 0
    }
}
EOF

response=$(aws ssm create-activation \
  --description "Activation for Amazon SageMaker integration with SSH and IDEs" \
  --iam-role "$SSH_SSM_ROLE" \
  --registration-limit 1 \
  --region "$CURRENT_REGION" \
  --tags "$SSH_SSM_TAGS")

if _is_centos; then
  yum install -y jq
fi

acode=$(echo $response | jq --raw-output '.ActivationCode')
aid=$(echo $response | jq --raw-output '.ActivationId')

echo Yes | amazon-ssm-agent -register -id "$aid" -code "$acode" -region "$CURRENT_REGION"
2022/11/04 15:52:39 Found config file at /etc/amazon/ssm/amazon-ssm-agent.json.
2022/11/04 15:52:39 processing appconfig overrides
Found config file at /etc/amazon/ssm/amazon-ssm-agent.json.
processing appconfig overrides

# See https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started-ssm-user-permissions.html
if _is_centos; then
  yum install -y sudo
else
  apt-get install -y sudo
fi
debconf: delaying package configuration, since apt-utils is not installed
echo "ssm-user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/ssm-agent-users
```
(replaced my SSHOwner value above with XXXX to keep it private)

from sagemaker-ssh-helper.

ivan-khvostishkov avatar ivan-khvostishkov commented on May 23, 2024

Hi, João.

Thanks for sharing the redacted output. It's still not clear where is the issue.

Could you also check and copy the logs from the /var/log/amazon/ssm/amazon-ssm-agent.log that appear when you run the sm-ssh-ide ssm-agent command?

You can do this by opening and image terminal (the small icon with $_ sign at the toolbar) and copying the log file to the home directory with the following command:

cp /var/log/amazon/ssm/amazon-ssm-agent.log ~

Then you can open this file from a file browser and copy-paste the relevant lines here or download and attach the whole file (if possible).

Regards,
Ivan

from sagemaker-ssh-helper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.