Kanji
・클라우드 엔지니어 / 프리랜서 ・1993년생 ・에히메현 출신 / 도쿄도 시부야구 거주 ・AWS 경력 5년 프로필 상세
목차
머메이드에서 이미지를 사용할 때, 크게 “1 img 태그로 이미지 URL을 지정하는 방법”과 “②아이콘 팩을 사용하는 방법” 두 가지 방법이 있습니다.다음은 기존 AWS 아키텍처 아이콘을 사용하는 방법을 설명합니다.
img
참고: 인어공주 흐름도 #초보자 노드 모양 변경 및 이미지/아이콘 지정 방법 -키이타
AWS 아이콘의 URL을 직접 지정하려면 Mermaid의 img 태그를 사용하세요.
flowchart TB subgraph ACCOUNT[AWS Account] subgraph GRP1[" "] ELB@{ img: "https://api.iconify.design/logos/aws-elb.svg", label: "ELB", pos: "b", w: 60, h: 60, constraint: "on" } end subgraph GRP2[" "] EC2@{ img: "https://api.iconify.design/logos/aws-ec2.svg", label: "EC2", pos: "b", w: 60, h: 60, constraint: "on" } end subgraph GRP3[" "] RDS@{ img: "https://api.iconify.design/logos/aws-rds.svg", label: "RDS", pos: "b", w: 60, h: 60, constraint: "on" } end ELB --- EC2 --- RDS end classDef vpc fill:none,color:#0a0,stroke:#0a0 class ACCOUNT vpc classDef group fill:none,stroke:none class GRP1,GRP2,GRP3 group
Mermaid로 렌더링하면 다음과 같습니다.
또 다른 방법은 인어 아이콘 팩을 사용하는 것입니다.이렇게 하면 각 아이콘에 대해 URL을 지정할 필요가 없습니다.
참고: 인어에 아이콘 팩 등록하기 |인어
flowchart TB subgraph ACCOUNT[AWS Account] subgraph GRP1[" "] ELB@{ icon: "logos:aws-elb", label: "ELB", pos: "b", h: 60} end subgraph GRP2[" "] EC2@{ icon: "logos:aws-ec2", label: "EC2", pos: "b", h: 60} end subgraph GRP3[" "] RDS@{ icon: "logos:aws-rds", label: "RDS", pos: "b", h: 60} end ELB --- EC2 --- RDS end classDef vpc fill:none,color:#0a0,stroke:#0a0 class ACCOUNT vpc classDef group fill:none,stroke:none class GRP1,GRP2,GRP3 group
하지만 이 방법은 Qiita나 GitHub와 같은 SaaS 플랫폼에서는 사용할 수 없습니다. 아이콘 팩을 사용하려면 아래와 같이 CDN 또는 서버에서 호스팅되는 JSON 파일을 로드해야 합니다.
<script> mermaid.registerIconPacks([ { name: 'logos', loader: () => fetch('https://unpkg.com/@iconify-json/logos@1/icons.json').then((res) => res.json()), }, ]); mermaid.initialize({startOnLoad:true}); </script>
이 사이트에서는 최신 AWS 아키텍처 아이콘으로 생성된 사용자 정의 아이콘 팩을 사용합니다.
최신 AWS 아키텍처 아이콘을 사용하려면 사용자 지정 인어 아이콘 팩을 생성해야 합니다. 이 섹션에서는 인어 아이콘 팩을 생성하고 최신 AWS 아키텍처 아이콘을 사용하는 방법을 설명합니다.
먼저, 다음 사이트에서 최신 AWS 아키텍처 아이콘을 다운로드하세요. [시작하기] -> [아이콘 패키지]를 클릭하면 다운로드가 시작됩니다.
AWS 단순 아이콘 - AWS 아키텍처 센터 |AWS
다운로드한 파일의 이름은 현재 ’Asset-Package_02072025.dee42cd0a6eaacc3da1ad9519579357fb546f803.zip’입니다. 압축을 풀면 아래와 같은 폴더 구조를 볼 수 있습니다.이 파일을 사용하여 인어 아이콘 팩을 만드세요.
Asset-Package_02072025.dee42cd0a6eaacc3da1ad9519579357fb546f803/ ├── Architecture-Group-Icons_02072025 │ ├── _32.png │ ├── _32.svg │ └── ... ├── Architecture-Service-Icons_02072025 │ ├── Arch_Cloud-Financial-Management │ ├── Arch_Compute │ └── ... ├── Category-Icons_02072025 │ ├── Arch-Category_16 │ ├── Arch-Category_32 │ └── ... └── Resource-Icons_02072025 ├── Res_Analytics └── Resource-Icons_02072025 ├── Res_Analytics ├── Res_Application-Integration └── ...
그런 다음, 다음 Python 스크립트를 적절한 디렉터리(예: collect_mermaid_icons.py )에 저장합니다. 스크립트는 re , os , json , argparse 등 표준 라이브러리만 사용합니다.
collect_mermaid_icons.py
re
os
json
argparse
import re import argparse FOLDER_FILE_PATTERNS = { "Architecture-Group-Icons": "_32.svg", "Architecture-Service-Icons": "_48.svg", "Category-Icons": "_48.svg", "Resource-Icons": "_48.svg", } def get_icon_folders(icon_root): return [name for name in os.listdir(icon_root) if os.path.isdir(os.path.join(icon_root, name))] def extract_svg_size(svg_content): m = re.search(r'<svg[^>]*width=["\']?(\d+)["\']?[^>]*height=["\']?(\d+)["\']?', svg_content) if m: return int(m.group(1)), int(m.group(2)) return 0, 0 def collect_svg_icons(icon_root): icon_folders = get_icon_folders(icon_root) icons = {} for folder in icon_folders: print(f"Processing folder: {folder}") folder_path = os.path.join(icon_root, folder) if not os.path.isdir(folder_path): continue pattern = None for key, value in FOLDER_FILE_PATTERNS.items(): if folder.startswith(key): pattern = value break for root, dirs, files in os.walk(folder_path): for file in files: icon_name = os.path.splitext(file)[0] normalized_name = icon_name.replace(pattern.replace(".svg", "").replace(".png", ""), "") if pattern else icon_name file_path = os.path.join(root, file) if pattern: if not file.endswith(pattern): continue svg_content = "" try: with open(file_path, "r", encoding="utf-8") as svg_file: svg_content = svg_file.read() fill_colors = re.findall(r'fill=["\'](#[0-9a-fA-F]{3,6})["\']', svg_content, flags=re.IGNORECASE) if fill_colors: main_color = fill_colors[0] if fill_colors else None svg_content = re.sub(r'fill=["\']#fff(?:fff)?["\']', f'fill="{main_color}"', svg_content, flags=re.IGNORECASE) except Exception: svg_content = "" width, height = extract_svg_size(svg_content) icons[normalized_name] = {"body": svg_content, "width": width, "height": height} continue return icons def main(): parser.add_argument("--icon-root", type=str, help="Root directory of AWS architecture icons") parser.add_argument("--output-json", type=str, default="./icons.json", help="Path to output JSON file (default: ./icons.json)") parser.add_argument("--icon-list-txt", type=str, default="./icon_list.txt", help="Path to icon name list TXT file (default: ./icon_list.txt)") args = parser.parse_args() error_flags = False error_messages = [] if not args.icon_root or not os.path.isdir(args.icon_root): error_flags = True error_messages.append("The icon root directory is not specified correctly. Please use the --icon-root option.") if not args.output_json: error_flags = True error_messages.append("The path to the output JSON file is not specified. Please use the --output-json option.") if not args.icon_list_txt: error_flags = True error_messages.append("The path to the icon name list TXT file is not specified. Please use the --icon-list-txt option.") if error_flags: for msg in error_messages: print(f"Error: {msg}") return icons = collect_svg_icons(args.icon_root) output = {"prefix": "logos", "icons": icons} with open(args.output_json, "w", encoding="utf-8") as f: json.dump(output, f, ensure_ascii=False, indent=2) icon_names = sorted(icons.keys()) with open(args.icon_list_txt, "w", encoding="utf-8") as f: for name in icon_names: f.write(name + "\n") if __name__ == "__main__": main()
By running this script, you can collect SVG icons from the specified AWS architecture icon root directory and generate a JSON file in the Mermaid icon pack format.
To execute the script, run the following command from the terminal. This will collect icons from the specified directory and generate both icons.json and icon_list.txt files.
icons.json
icon_list.txt
python collect_mermaid_icons.py \ --icon-root /path/to/Asset-Package_02072025.dee42cd0a6eaacc3da1ad9519579357fb546f803 \ # Optional --output-json ./icons.json \ --icon-list-txt ./icon_list.txt
The generated icons.json file can be used as a Mermaid icon pack. Below is an example of the actual icon pack JSON generated by the script.
{ "prefix": "logos", "icons": { "Arch-Category_Storage": { "body": "<svg width=\"74px\" height=\"74px\" viewBox=\"0 0 74 74\" xmlns=\"http://www.w3.org/2000/svg\">...</svg>", "width": 74, "height": 74 }, "Arch_Amazon-EC2": { "body": "<svg width=\"64px\" height=\"64px\" viewBox=\"0 0 64 64\" xmlns=\"http://www.w3.org/2000/svg\">...</svg>", "width": 64, "height": 64 }, "Arch_Amazon-RDS": { "body": "<svg width=\"64px\" height=\"64px\" viewBox=\"0 0 64 64\" xmlns=\"http://www.w3.org/2000/svg\">...</svg>", "width": 64, "height": 64 }, "Arch_Elastic-Load-Balancing": { "body": "<svg width=\"64px\" height=\"64px\" viewBox=\"0 0 64 64\" xmlns=\"http://www.w3.org/2000/svg\">...</svg>", "width": 64, "height": 64 }, "Arch_Amazon-Simple-Storage-Service": { "body": "<svg width=\"64px\" height=\"64px\" viewBox=\"0 0 64 64\" xmlns=\"http://www.w3.org/2000/svg\">...</svg>", "width": 64, "height": 64 }, "Arch_AWS-Lambda": { "body": "<svg width=\"64px\" height=\"64px\" viewBox=\"0 0 64 64\" xmlns=\"http://www.w3.org/2000/svg\">...</svg>", "width": 64, "height": 64 } } }
전체 icons.json 파일(780개 이상의 공식 AWS SVG 아이콘 포함)은 위 2단계의 collect_mermaid_icons.py 를 실행하면 몇 초 만에 로컬에서 생성됩니다. 페이지 로딩 속도를 위해 위 코드는 주요 서비스(EC2, RDS, ELB, S3, Lambda)의 대표 구조를 발췌한 예시입니다.
Finally, load the Mermaid icon pack. If you want to load the JSON file from your server, add the following code to your HTML file:
<script> mermaid.registerIconPacks([ { name: 'logos', loader: () => fetch('./icons.json').then((res) => res.json()), }, ]); mermaid.initialize({ startOnLoad: true }); </script>
On this site, we implement it by writing the contents of the JSON file into the mermaid-icons-json element according to the page.
mermaid-icons-json
<script type="application/json" id="mermaid-icons-json"> </script> <script> mermaid.registerIconPacks([ { name: 'logos', loader: () => { const jsonText = document.getElementById('mermaid-icons-json').textContent; return Promise.resolve(JSON.parse(jsonText)); }, }, ]); mermaid.initialize({ startOnLoad: true }); </script>
To specify an icon pack, use the icon name after logos: . The available icon names in the pack you created are listed in the icon_list.txt file.
logos:
flowchart TB subgraph ACCOUNT[AWS Account] subgraph GRP1[" "] ELB@{ icon: "logos:Arch_Elastic-Load-Balancing", label: "ELB", pos: "b", w: 60, h: 60, constraint: "on" } end subgraph GRP2[" "] EC2@{ icon: "logos:Res_Amazon-EC2_Instance", label: "EC2", pos: "b", w: 60, h: 60, constraint: "on" } end subgraph GRP3[" "] RDS@{ icon: "logos:Arch_Amazon-RDS", label: "RDS", pos: "b", w: 60, h: 60, constraint: "on" } end ELB --- EC2 --- RDS end classDef vpc fill:none,color:#0a0,stroke:#0a0 class ACCOUNT vpc classDef group fill:none,stroke:none class GRP1,GRP2,GRP3 group
When displayed in Mermaid, it looks like this: As mentioned at the beginning, the ELB and RDS icons have different colors from the latest AWS architecture icons. This is because the color conversion did not work well when processing the AWS architecture icon SVG files.
Real-time AI quant analysis of corporate earnings reports.
실전 같은 AI 음성 모의 통화와 5축 정밀 피드백. 16강 인터랙티브 강의와 스튜디오급 AI 프로필 생성 지원.
영수증 촬영 즉시 Gemini AI가 품목과 금액을 자동 인식. 모임 및 여행 경비를 손쉽게 더치페이하고 정산합니다.
점술사, 집사, 바텐더 AI 캐릭터가 직접 게임을 진행하고 대화 주제를 던져 모임을 흥미진진하게 만듭니다.
人工甘味料や添加物のNG除外と有効成分あたりの実質単価比較データベース。