CLIコマンド

AWS CLI Tips

aws secretsmanager put-secret-value \
    --secret-id MyJsonSecret \
    --secret-string file://new_secret.json
登録するJSONデータ

new_secret.json というファイル名で以下を作成

{
  "services": [
    {"name": "service1", "endpoint": "https://newservice1.example.com"},
    {"name": "service2", "endpoint": "https://newservice2.example.com"}
  ],
  "config": {
    "retryAttempts": 10,
    "timeout": 60
  }
}
aws secretsmanager create-secret \
    --name MyComplexSecret \
    --secret-string '{
        "services": [
            {"name": "service1", "endpoint": "https://service1.example.com"},
            {"name": "service2", "endpoint": "https://service2.example.com"}
        ],
        "config": {
            "retryAttempts": 5,
            "timeout": 30
        }
    }'
aws lambda get-function --function-name <Lambda関数名> --query 'Code.Location' --output text
curl "<取得したURL>" -o "lambda_function.zip"
Expand-Archive -Path "lambda_function.zip" -DestinationPath "C:\path\to\extract"

アップロード

Compress-Archive -Path "C:\path\to\your\lambda_code\*" -DestinationPath "C:\path\to\your\lambda_function.zip"
aws lambda update-function-code --function-name <Lambda関数名> --zip-file fileb://C:\path\to\your\lambda_function.zip
aws apigateway get-authorizers --rest-api-id rest0010 \
  --output json | jq -r '.items[] | select(.authorizerUri | contains("test-func-name")) | .id'
スポンサーリンク
タイトルとURLをコピーしました