Input
\documentclass[version=last,paper=A4,parskip=half]{scrartcl}
\usepackage[utf8]{inputenc}
\usepackage[T1]{fontenc}
\usepackage{mlmodern}
\usepackage[american]{babel}
\usepackage[final,babel]{microtype}
\usepackage{lipsum}
\usepackage{tikz}
\usepackage{tcolorbox}
\usetikzlibrary{arrows.meta,calc,fit}
\tcbuselibrary{most}
\begin{document}
\lipsum[1-1]
{%
\tcbset{%
enhanced,%
size=fbox,%
on line,%
box align=center,%
fonttitle=\small,%
fontupper=\small,%
fontlower=\small,%
halign title=center,%
halign upper=center,%
halign lower=center,%
}%
\begin{tcolorbox}[title=Microservices,remember as=JSON,width=.2\linewidth]
JSON events\tcblower{}Kafka
\end{tcolorbox}%
\hfill%
\begin{tcolorbox}[title=Databricks,remember as=Spark,width=.2\linewidth]
Spark\tcblower{}EC2 \& EBS
\end{tcolorbox}%
\hfill%
\begin{minipage}{.2\linewidth}
\begin{tcolorbox}[remember as=Oracle]
Oracle
\end{tcolorbox}%
\\%
\begin{tcolorbox}[remember as=Delta]
Delta Lake\tcblower{}S3
\end{tcolorbox}
\end{minipage}%
\hfill%
\begin{minipage}{.15\linewidth}
\begin{tcolorbox}[remember as=Exasol]
Exasol
\end{tcolorbox}%
\\%
\begin{tcolorbox}[remember as=Presto]
Presto
\end{tcolorbox}%
\end{minipage}%
\begin{tikzpicture}[%
overlay,%
remember picture,%
>=Stealth,%
shorten >=1pt,%
shorten <=1pt,%
surround/.style 2 args={%
draw,%
rectangle,%
thick,%
dotted,%
fit=#1,%
inner sep=8pt,%
label={[align=center,scale=0.75]#2},%
},%
]
\coordinate (Spark-SSE) at ($(Spark.south)!0.5!(Spark.south east)$);
\coordinate (Spark-NNE) at ($(Spark.north)!0.5!(Spark.north east)$);
\coordinate (Delta-SSW) at ($(Delta.south)!0.5!(Delta.south west)$);
\coordinate (Exasol-NNW) at ($(Exasol.north)!0.5!(Exasol.north west)$);
\path[->]
(JSON) edge (Spark)
(Spark) edge (Oracle)
(Oracle) edge (Exasol)
(Spark) edge (Delta)
(Delta) edge[<->] (Presto)
(Delta-SSW) edge[out=-150,in=-30]
node[midway,below,scale=0.75] {SNS \& SQS} (Spark-SSE)
(Spark-NNE) edge[out=30,in=150] (Exasol-NNW);
\node[surround={(Spark)}{Airflow}] (Scheduling) {};
\node[surround={(Exasol)(Presto)}{Superset\\MicroStrategy}] (Reporting) {};
\end{tikzpicture}%
}
\lipsum[2-2]
\end{document}
Output
Click to view output with no spacing around overlaid TikZ picture
Question
How can I automatically add spacing around the overlaid TikZ picture so that its contents do not go over the surrounding text?
vspace{}
before and after the drawing