import os

def lambda_handler(event, context):
    # EFSにマウントされているパスへのパス
    efs_mount_path = '/mnt/efs'  # Lambda関数設定で指定したマウントパスに合わせてください
    test_file_path = os.path.join(efs_mount_path, 'test_file.txt')

    # テストファイルに書き込む内容
    test_content = 'Hello, EFS from Lambda!'

    # テストファイルを作成して書き込む
    with open(test_file_path, 'w') as test_file:
        test_file.write(test_content)

    # テストファイルから内容を読み取る
    with open(test_file_path, 'r') as test_file:
        file_content = test_file.read()

    # 確認したファイルの内容を返す
    return {
        'statusCode': 200,
        'body': file_content
    }