AWS - SSM - ログイン


 クラウディア


1. 概要
2. アクセスキー登録
3. ログイン
4. .ttl 作成
5. SFTP
6. 参考サイト

1. 概要

 準備が整いましたので、ログインします。

2. アクセスキー登録

 「AWS CLI」へアクセスキーを登録します。  管理者権限で、コマンドプロンプトを開いて。

aws configure --profile profile_name

Tip: You can deliver temporary credentials to the AWS CLI using your AWS Console session by running the command 'aws login'.

AWS Access Key ID [None]:
AWS Secret Access Key [None]:
Default region name [None]:
Default output format [None]:

Tip: run 'aws configure agent-toolkit' to set up AWS skills and the AWS MCP server for your AI coding agent(s).
 「AWS Access Key ID」「AWS Secret Access Key」へそれぞれ、前ページで作成した、アクセスキーとシークレットアクセスキーを入力。  「Default region name」へ「ap-northeast-1」(東京)を入力。  「Default output format」へ「json」を入力します。

Configure AWS skills and the AWS MCP server for your AI coding agent(s)? [y/n/never]:

Detecting installed AI coding agents...
  ✓ Claude Code — C:\Users\kitay/.claude/skills
  ✗ Cline — ~/.cline/skills (not found)
  ✗ Codex — ~/.agents/skills (not found)
  ✗ Cursor — ~/.cursor/skills (not found)
  ✗ Gemini CLI — ~/.agents/skills (not found)
  ✗ Kiro — ~/.kiro/skills (not found)
  ✗ OpenClaw — ~/.openclaw/skills (not found)
  ✗ OpenCode — ~/.agents/skills (not found)
  ✗ Pi — ~/.pi/agent/skills (not found)
  ✗ Windsurf — ~/.agents/skills (not found)

Fetching default AWS skills...
  Found: amazon-bedrock, aws-ai-ml, aws-auth, aws-billing-and-cost-management, aws-blocks, aws-cdk, aws-cloudformation, aws-compute, aws-containers, aws-database, aws-deployment, aws-iam, aws-messaging-and-streaming, aws-networking, aws-observability, aws-sdk-js-v3-usage, aws-sdk-python-usage, aws-sdk-swift-usage, aws-security, aws-serverless, aws-storage, launch-with-aws, setting-up-cloudwatch-observability, signing-in-to-aws

Install 24 default AWS skills? [Y/n]:

Installing 24 default AWS skills...
  [1/24] amazon-bedrock
  [2/24] aws-ai-ml
  [3/24] aws-auth
  [4/24] aws-billing-and-cost-management
  [5/24] aws-blocks
  [6/24] aws-cdk
  [7/24] aws-cloudformation
  [8/24] aws-compute
  [9/24] aws-containers
  [10/24] aws-database
  [11/24] aws-deployment
  [12/24] aws-iam
  [13/24] aws-messaging-and-streaming
  [14/24] aws-networking
  [15/24] aws-observability
  [16/24] aws-sdk-js-v3-usage
  [17/24] aws-sdk-python-usage
  [18/24] aws-sdk-swift-usage
  [19/24] aws-security
  [20/24] aws-serverless
  [21/24] aws-storage
  [22/24] launch-with-aws
  [23/24] setting-up-cloudwatch-observability
  [24/24] signing-in-to-aws

Skills installed to:
  Claude Code — C:\Users\kitay/.claude/skills

Configure AWS MCP server connection? [Y/n]:

AWS MCP server configured for:
  ✓ Claude Code — C:\Users\kitay/.claude.json: updated

You can discover additional skills with 'aws agent-toolkit search-skills --search-query <text>'
 問い合わせには、すべて、YEnter もしくは Enter で答えます。  うまく作成できたか、確認します。

aws sts get-caller-identity --profile profile_name
 この結果。

{
    "UserId": "xxxxxxxxxxxxxxxxxxxxx",
    "Account": "xxxxxxxxxxxx",
    "Arn": "arn:aws:iam::xxxxxxxxxxxx:user/xxxxxxxx"
}
 それぞれの箇所に、正しい値が表示されていれば、正常に設定されています。

3. ログイン

 ログインできるか、試してみます。  コマンドプロンプトを開いて。

aws ssm start-session --target i-xxxxxxxxxxxxxxxxx --document-name AWS-StartPortForwardingSession --parameters "portNumber=22,localPortNumber=10022" --profile prfile_name

Starting session with SessionId: prfile_name-xxxxxxxxxxxxxxxxxxxxxxxxxx
Port 10022 opened for sessionId prfile_name-xxxxxxxxxxxxxxxxxxxxxxxxxx.
Waiting for connections...
 「Waiting for connections...」が表示されれば、接続待ちになっています。  ここで、「TeraTerm」を起動します。  下記で接続し。 ・ホスト localhost ・TCPポート 10022 ・サービス SSH2  次の画面で、下記を設定します。 ・User name 「EC2」インスタンスのログインID ・Use RSA... key to login 「EC2」インスタンスの証明書ファイル  うまく設定されていれば、ログインできるはずです。

4. .ttl 作成

 「inctance_name.ttl」を作成して、下記を記述します。

exec '"C:\Program Files\Amazon\AWSCLIV2\aws.exe" ssm start-session --target instance_id --document-name AWS-StartPortForwardingSession --parameters "portNumber=22,localPortNumber=10022" --profile profile_name' 'minimize'
pause 5
connect 'localhost:10022 /ssh /2 /auth=publickey /user=ubuntu /keyfile=path/to/keyfile.pem'
 上記は、それぞれの箇所に下記を設定します。 ・instance_id 「EC2」のインスタンス ID ・profile_name 前々項で作成したプロファイル名 ・path/to/keyfile.pem 「EC2」インスタンスの証明書ファイル  以降は、作成した、「.ttl」をダブルクリックすることで、ログインできるようになります。  「TeraTerm」を起動すると、同時にコマンドプロンプトが起動しちゃうのが、玉に瑕ですが。

5. SFTP

 「FileZilla」を使用して、「SFTP」で接続する方法については、「FTP クライアント - FileZilla」をご参照ください。

6. 参考サイト

 本ページは、「Claude」上等兵を参考にさせていただきました。

audiobook.jp
ハイスピードプラン
TikTok Shop 【リピート用プログラム】
JETBOY
健康サポート特集
アフィリエイトのアクセストレード
5G CONNECT
サウンドハウス
損保との違い
ネットオークションの相場、統計、価格比較といえばオークファン
U-NEXT
葬送のフリーレン Prime Video
ベルリッツ
【usus ウズウズ】
それがだいじWi-Fi
薬屋の独り言
Amazonギフトカード
EaseUS
earthcar(アースカー)