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?

test log

Last updated at Posted at 2025-09-10
import os
import json
import urllib3

http = urllib3.PoolManager()

ALB_DNS = os.environ.get("LB_DNS", "internal-xxx-alb-xxxxx.ap-northeast-1.elb.amazonaws.com")
PATH = "/v1/distributed-processing"

def lambda_handler(event, context):
    url = f"http://{ALB_DNS}{PATH}"
    
    payload = {"salesCode": "01"}   # 你的 ECS API 需要的 body
    try:
        resp = http.request(
            "POST",
            url,
            body=json.dumps(payload).encode("utf-8"),
            headers={"Content-Type": "application/json"},
            timeout=urllib3.Timeout(connect=2.0, read=10.0)
        )
        return {
            "statusCode": resp.status,
            "body": resp.data.decode("utf-8")
        }
    except Exception as e:
        return {
            "statusCode": 500,
            "body": str(e)
        }

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?