0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

requirements

Last updated at Posted at 2025-10-27
pip download -r requirements.txt -d wheelhouse `
  --only-binary=:all: `
  --platform manylinux2014_x86_64 `
  --implementation cp `
  --python-version 312 `
  --abi cp312
#!/usr/bin/env bash
set -eu
APP_DIR="$(cd "$(dirname "$0")" && pwd)"

# vendor を最優先に通す
export PYTHONPATH="${APP_DIR}/vendor:${PYTHONPATH:-}"
export PYTHONNOUSERSITE=1

exec python "${APP_DIR}/main.py" "$@"
import boto3, yaml, sys
print("boto3:", boto3.__version__)
print("yaml:", yaml.__version__ if hasattr(yaml, "__version__") else "ok")
print("sys.path[0:3]:", sys.path[:3])
~/app/test.sh -c "import boto3, logging; logging.basicConfig(level=logging.DEBUG); boto3.set_stream_logger('botocore'); s3=boto3.client('s3'); print(s3.list_buckets())"
# どこで止まっているか詳細表示(ページャ無効&タイムアウト短縮)
aws --debug --no-cli-pager \
    --cli-connect-timeout 3 --cli-read-timeout 5 \
    iam list-attached-role-policies --role-name MyEC2Role

# 1) DNS 解決できる?
getent hosts iam.amazonaws.com || nslookup iam.amazonaws.com

# 2) 443/TCP に届く?(3秒で諦める)
timeout 3 bash -c 'cat </dev/null >/dev/tcp/iam.amazonaws.com/443' && echo TCP_OK || echo TCP_FAIL

TOKEN=$(curl -sS --connect-timeout 2 --max-time 2 -X PUT -H "X-aws-ec2-metadata-token-ttl-seconds: 21600" http://169.254.169.254/latest/api/token) && echo "TOKEN_LEN=${#TOKEN}" && curl -sS --connect-timeout 2 --max-time 2 -H "X-aws-ec2-metadata-token: $TOKEN" http://169.254.169.254/latest/meta-data/iam/info || echo "IMDS_REQ_ERR"
~/app/run.sh -c "import faulthandler,sys,time,boto3; from botocore.config import Config; \
faulthandler.enable(); faulthandler.dump_traceback_later(5, file=sys.stderr); \
s3=boto3.client('s3',config=Config(region_name='ap-northeast-1',connect_timeout=3,read_timeout=10)); \
print(s3.list_buckets()); faulthandler.cancel_dump_traceback_later()"

~/app/test.sh -c "import boto3; from botocore.config import Config; c=boto3.client('s3',config=Config(region_name='ap-northeast-1')); print('endpoint=', c.meta.endpoint_url)"
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?