Zum Hauptinhalt springen
Echtzeit-Radar & Feeds
Alle RSS Feeds ➔
👥 Community & Social
YouTube Security VideosVisual Studio Code: VS Code Learn: Extending Agents(24.09.2026 um 21:00 Uhr)
•
YouTube Security VideosGoogle Cloud Tech: Turn Audio into Action with Gemini 3.5 Transcribe(24.09.2026 um 21:00 Uhr)
••••
Unix & Linux ServerUSN-8815-1: libass vulnerabilities(24.09.2026 um 16:57 Uhr)
•••••
YouTube Security VideosVisual Studio Code: VS Code Learn: Extending Agents(24.09.2026 um 21:00 Uhr)
•
YouTube Security VideosGoogle Cloud Tech: Turn Audio into Action with Gemini 3.5 Transcribe(24.09.2026 um 21:00 Uhr)
••••
Unix & Linux ServerUSN-8815-1: libass vulnerabilities(24.09.2026 um 16:57 Uhr)
•••••
Intelligence View
⚡ tsecurity.de Intelligence

Building a Go Application with Docker on AWS: Creating a RESTful Interface for Adding and Retrieving Items

Introduction While most Go applications are compiled into a single binary file, web applications also come with templates, assets, and configuration files; these can get out of sync and cause erroneous deployments. Docker allows us to…

0
↗ Quelle (dev.to)
Reagiere als Erste:r — dein Feedback zählt!

Introduction



While most Go applications are compiled into a single binary file, web applications also come with templates, assets, and configuration files; these can get out of sync and cause erroneous deployments.

Docker allows us to create a standalone image with everything our application needs to run. In this article, we will learn how to deploy a Go web application using Docker installed on an instance, and how Docker can help you improve your development workflow and deployment process.



The steps we need will be as follows:



- Launch an instance (your machine)to build Docker on and the Go

application


- Install Docker in instance

- Installing Go in instance

- Create code files for your Go application

- Application Testing



Launch an instance (your machine)to build Docker on and the Go

application



You can find the same steps of the launch and connect of instance described in the article:



https://dev.to/zahraajawad/building-a-jupyter-notebook-environment-in-docker-for-data-analysis-on-aws-ec2-376i



Note: Make sure you choose the security group:




  • SSH-Port 22: To access and connect to the instance using SSH

    protocol to manage the system remotely.


  • HTTP-Port 8080: To run the Go application on this port (8080) to access it from the Internet or local network, this port must be open.




- Install Docker in our instance



The specific workflow architecture we will create uses Docker to provide an integrated workflow environment.

So after connecting to the instance via SSH and obtaining the root privilege, use the following command automation to install Docker:



curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo apt-key add - && sudo add-apt-repository "deb [arch=amd64] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" && sudo apt-get update && apt-cache policy docker-ce



Docker experience: Run a simple test command docker -v to check that Docker is working properly and to see the Docker version:



Installing Go



You can install Go by downloading it from the official Go website https://go.dev/dl/

wget https://golang.org/dl/go1.20.linux-amd64.tar.gz

sudo tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz

echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bash_profile

source ~/.bash_profile



Image description

where :

wget https://golang.org/dl/go1.20.linux-amd64.tar.gz is to download Go binary.



and

sudo tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz is to extract the tarball to /usr/local.

and

echo 'export PATH=$PATH:/usr/local/go/bin' >> ~/.bash_profile to Update the PATH environment variable.

and source ~/.bash_profile to apply the changes made to the profile



So after executing the commands and verifying the execution through the command ls to show the downloaded files:



Image description

Initialize the Go application with the following code:

go mod init my-go-app

Image description



Now we need to create a project folder by the command:

mkdir <name of our work>

Then change the current directory by the command :

cd <name of our work>

so the execution is :



Image description



Create code files for your Go application



The main.go file



We create a new file called main.go which contains the following functions and codes which we will explain in detail and then we put all the codes in the main.go file:




  • To import the necessary packages we use the code:



import (
"encoding/json"
"log"
"net/http"
"github.com/gorilla/mux"
"os"
)






  • For the data structure item:



type Item struct {
ID int `json:"id"`
Name string `json:"name"`
}





where itemis a data structure containing an identifier (ID) and a name (Name). These fields are converted to JSON format using tags (json:"id" and json:"name".





  • items variable



var items []Item





which is a slice of items stored in server memory.




  • Through the main function the structures are arranged by reading the port (here it will be on port 8080) in addition to directing the various requests from retrieving or adding a new element and displaying a simple HTML page.



func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}

router := mux.NewRouter()
router.HandleFunc("/items", getItems).Methods("GET")
router.HandleFunc("/items", createItem).Methods("POST")
router.HandleFunc("/", serveHome).Methods("GET")

log.Printf("Server is running on port %s...\n", port)
log.Fatal(http.ListenAndServe(":"+port, router))
}






  • The function getItems returns a list of items in JSON format. The content type in the header is set to application/json.



func getItems(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(items)
}






  • The createItem function adds a new item to the items list. The data is read from the Request Body in JSON format, the item is assigned an ID based on the number of existing items, and the added item is returned as JSON.



func createItem(w http.ResponseWriter, r *http.Request) {
var item Item
json.NewDecoder(r.Body).Decode(&item)
item.ID = len(items) + 1
items = append(items, item)
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(item)
}






  • The serveHome function displays a simple HTML page with a welcome message (Welcome to the Go App) and links to access the data.



func serveHome(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html")
w.WriteHeader(http.StatusOK)
w.Write([]byte(`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Go App</title>
</head>
<body>
<h1>Welcome to the Go App</h1>
<p>This is a simple API application.</p>
<p>Access <a href="/items">/items</a> to see all items.</p>
</body>
</html>
`))
}





So the entire main.go file is:




package main

import (
"encoding/json"
"log"
"net/http"
"github.com/gorilla/mux"
"os"
)

// Item represents the data structure we will be using
type Item struct {
ID int `json:"id"`
Name string `json:"name"`
}

var items []Item

func main() {
port := os.Getenv("PORT")
if port == "" {
port = "8080"
}

router := mux.NewRouter()
router.HandleFunc("/items", getItems).Methods("GET")
router.HandleFunc("/items", createItem).Methods("POST")
router.HandleFunc("/", serveHome).Methods("GET")

log.Printf("Server is running on port %s...\n", port)
log.Fatal(http.ListenAndServe(":"+port, router))
}

func getItems(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(items)
}

func createItem(w http.ResponseWriter, r *http.Request) {
var item Item
json.NewDecoder(r.Body).Decode(&item)
item.ID = len(items) + 1
items = append(items, item)
w.Header().Set("Content-Type", "application/json")
json.NewEncoder(w).Encode(item)
}

func serveHome(w http.ResponseWriter, r *http.Request) {
w.Header().Set("Content-Type", "text/html")
w.WriteHeader(http.StatusOK)
w.Write([]byte(`
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Go App</title>
</head>
<body>
<h1>Welcome to the Go App</h1>
<p>This is a simple API application.</p>
<p>Access <a href="/items">/items</a> to see all items.</p>
</body>
</html>
`))
}







Now through the command vim or nano create the main.go file and put above code in the file, here we will use the command nano:



nano main.go



Image description

And past the codes:



Image description



then exit the file from the keyboard by ctrl x then y (to save the file) then click enter



Image description



Dockerfile:



Is a text document that contains all the commands a user could call on the command line to assemble an image.

Dockerfile can build images automatically by reading the instructions from a Dockerfile.



Create a Dockerfile:



A Dockerfile with build instructions is required to build a container image with Docker.

We create a Dockerfile and add the following code in the same way as before through the command nano Dockerfile:



Image description



Image description



Dockerfile command details can be found on the docker docs homepage https://docs.docker.com/guides/golang/build-images/



Now that we have prepared the Dockerfile, it is time to build a Docker image for the Go application. The image can be made from the official Docker images which are:



docker build -t my-go-app .



Image description



Image description

The image is successfully built, and to make sure of the build by using the command:

docker images



Image description



Then to run the container after building the image, we use:



docker run -p 8080:8080 my-go-app



where 8080 is the port of the web servers, so the execution run is:



Image description



Application Testing



- Test the Go application by the curl command



To test whether the Go application works properly through the curl command by:



curl http://localhost:8080/items



or



curl http://<public IPv4 address of our instance>:8080/items



Image description



the execution is null, which means the application is working but we have no data yet.



To add an item, by the command:



curl -X POST -H "Content-Type: application/json" -d '{"name": "item"}' http://localhost:8080/items



or



curl -X POST -H "Content-Type: application/json" -d '{"name": "item"}' http://<public IPv4 address of our instance>:8080/items



Image description



so the execution of adding:



Image description



we can add another item:



Image description



- Test the Go application by the web page



To test whether the Go application works properly through the web page, the following steps:




  • Go back to the instance and select it by the checkbox.

  • Go to the Details and copy the Public IPv4 address.

  • Paste the public IPv4 address with port 8080 into the browser and press
    Enter.



Image description



The web page is working and when we press on items on the page we obtain the items that add by the curl command.



Image description



Or can press the checkbox of Pretty-print:



Image description



Image description



References:



IoC Intelligence (1 Indikatoren)
dev[.]to
CTI Threat Relationship Graph3 Knoten / 2 Relationen
CVE / Incident Software MITRE ATT&CK CWE Weakness IoC
SOC Incident Playbook: Remote Code Execution (RCE) Defense
Syntax validiert (0 Fehler)
title: Detect Exploitation - Building a Go Application with Docker on AWS: Creating a RESTful Interface for Adding and Retrieving Items
id: a8053307-9b7d-4ffc-8fd2-c6cedf5ac643
status: experimental
description: Automatisch generierte SIEM-Erkennungsregel basierend auf CTI Intelligence
references:
  - https://tsecurity.de/
author: iShareStuff CTI Automated Detection Engine
date: 2026-09-24
logsource:
  category: network_connection
  product: any
detection:
  selection:
      DestinationHostname:
        - 'dev.to'
  condition: selection
falsepositives:
  - Legitime administrative Zugriffe oder Penetrationstests
level: high
tags:
  - attack.initial_access
Syntax validiert (0 Fehler)
rule CTI_Threat_Indicator {
    meta:
        author = "iShareStuff CTI Automated Detection Engine"
        date = "2026-09-24"
        description = "YARA Signature for "
    strings:
        $str = "Building a Go Application with" ascii wide
    condition:
        any of them
}
Syntax validiert (0 Fehler)
index=security sourcetype IN ("cisco:asa", "pan:traffic", "zeek_conn", "suricata", "WinEventLog:Security")
(dest_host="dev.to")
| stats count earliest(_time) as first_seen latest(_time) as last_seen by src_ip, dest_ip, dest_host, signature
| eval first_seen=strftime(first_seen, "%Y-%m-%d %H:%M:%S"), last_seen=strftime(last_seen, "%Y-%m-%d %H:%M:%S")
| sort - count
Syntax validiert (0 Fehler)
destination.domain: ("dev.to") and event.category: "network"
Syntax validiert (0 Fehler)
CommonSecurityLog
| where DestinationHostName in ("dev.to")
| summarize EventCount = count(), FirstSeen = min(TimeGenerated), LastSeen = max(TimeGenerated) by SourceIP, DestinationIP, DestinationPort, Activity
| extend DetectionRule = "iShareStuff-CTI-Compiled"
| sort by EventCount desc
🎯
MITRE ATT&CK Matrix Navigator 14 Taktiken
Reconnaissance
-
Resource Development
-
Initial Access
Execution
Persistence
-
Privilege Escalation
Defense Evasion
Credential Access
-
Discovery
-
Lateral Movement
-
Collection
-
Command and Control
Exfiltration
-
Impact
tsecurity.de Cognitive Threat RAG
Fokus-Vektor:

Kognitive Analyse für identifizierte Bedrohung: Erhöhte Bedrohungslage im Bereich Building a Go Application with Docker on.... Basierend auf 368k Vektor-Korrelationen werden sofortige Isolationsmaßnahmen für betroffene Endpunkte empfohlen.

🛡️ Angriffsfläche & Exposure

Netzwerk/Remote-Zugriff ohne Vorauthentifizierung möglich.

⚡ Empfohlene Sofortmaßnahmen
  • 1. Perimeter-Inspektion: Relevante Portfreigaben und exponierte Endpunkte unverzüglich scannen.
  • 2. Patch-Applikation: Hersteller-Hotfix einspielen oder betroffene Daemons in isolierte DMZ-Segmente überführen.
  • 3. Telemetrie & EDR-Alerts: Prozessaufrufe und Child-Processes auf anomale Shell-Spawns überwachen.
🔗 Semantisch verwandte Zero-Days MariaDB 11.7 VEC
Ähnliche Beiträge
🔍 Verwandte News

Auch interessante Nachrichten Building a Go Application with Docker on AWS: Creating a RESTful Interface for Adding and Retrieving Items

Thematisch verwandte Begriffe: Building, Application, with, Docker · 6 Treffer

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Laden...

Beiträge werden geladen ...

Laden...

Videos werden geladen ...

Zum Aktualisieren ziehen
ZERO-DAY CVE-2026-61823 | code16 Sharp is a Laravel-based framework for building content-managemen…
Advisory →
tsecurity.de Icon
Offline-Lesen, Eilmeldungen & 0ms Ladezeit

Installiere tsecurity.de direkt auf deinen Home-Bildschirm für das ultimative Vollbild-Magazinerlebnis ohne Browser-Leisten.

Nächster Beitrag
Themen-Radar & Intelligence Matrix
Echtzeit-Taxonomie nach Angriffsvektoren & Plattformen

tsecurity.de Live Threat Radar

🔴 LIVE RADAR
MONITORING
AKTIV
CVE-DATENBANK
LIVE
🔍
Community Radar & Live Chat
Sentinel Bot online • Live-Stream
Dein Cluster: Security Explorer
Match:
lädt…
Verbindung zum Community-Stream wird aufgebaut...
Bearbeitungsmodus — Senden überschreibt deine Nachricht
Community-Puls — was gerade passiert
lädt…
Aktivitäten deiner Analysten
lädt…
Neues Thema oder Eilmeldung einreichen

Reiche interessante Links, Zero-Days oder Debatten ein. Die Community entscheidet per Upvote über die Veröffentlichung.

Heiß diskutierte Einreichungen
📂 Keine gespeicherten Artikel vorhanden.
Zurück Ziehen Vor
Links: vorheriger Artikel • Rechts: nächster Artikel • unten: schließen
News NIS-2 Frühwarnung Tier-1 Intel TTP ⏱️ 3 Min vor 10 Min
Artikeldaten werden geladen...
↗ Original-Quelle