반응형

C# WinForm 으로 구글 클라우드 비전 API를 이용해 Detect localized objects in a single image 를 진행해 보자. 아래 링크를 참고해 기본 준비를 한다.

2022.02.11 - [C#] - C# Google Cloud Vision API - 구글 클라우드 비전 API 2

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
using Google.Cloud.Vision.V1;
 
namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        ImageAnnotatorClient client;
 
        public Form1()
        {
            InitializeComponent();
 
            try
            {
                client = new ImageAnnotatorClientBuilder
                {
                    CredentialsPath = "your_credentials.json"
                }.Build();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
                Close();
            }
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                System.Drawing.Image systemImage;
 
                OpenFileDialog dlg = new OpenFileDialog();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    systemImage = System.Drawing.Image.FromFile(dlg.FileName);
                    pictureBox1.Image = systemImage;
 
                    pictureBox1.Refresh();
 
                    Graphics graphics = pictureBox1.CreateGraphics();
 
                    Google.Cloud.Vision.V1.Image visionImage = Google.Cloud.Vision.V1.Image.FromFile(dlg.FileName);
 
                    IReadOnlyList<LocalizedObjectAnnotation> annotations = client.DetectLocalizedObjects(visionImage);
                    foreach (LocalizedObjectAnnotation annotation in annotations)
                    {
                        Google.Protobuf.Collections.RepeatedField<NormalizedVertex> normalizedVertices =
                            annotation.BoundingPoly.NormalizedVertices;
 
                        int imageWidth = systemImage.Width;
                        int imageHeight = systemImage.Height;
                        // Google.Cloud.Vision.V1.Image 는 Width, Height 필드가 없다.
 
                        Rectangle rectangle = new Rectangle(
                            (int)(normalizedVertices[0].X * imageWidth),
                            (int)(normalizedVertices[0].Y * imageHeight),
                            (int)((normalizedVertices[2].X - normalizedVertices[0].X) * imageWidth),
                            (int)((normalizedVertices[2].Y - normalizedVertices[0].Y) * imageHeight)
                            );
                        // BoundingPoly.NormalizedVertices 는 0~1의 범위를 가지는 값이다.
 
                        StringFormat stringFormat = new StringFormat
                        {
                            Alignment = StringAlignment.Center,
                            LineAlignment = StringAlignment.Center
                        };
 
                        graphics.DrawRectangle(System.Drawing.Pens.Red, rectangle);
                        graphics.DrawString($"Name: {annotation.Name}\n ID: {annotation.Mid}\n Score: {annotation.Score}",
                            Font, Brushes.Red, rectangle, stringFormat);
                    }
 
                    graphics.Dispose();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
    }
}
 

 

소스를 입력하고 빌드한다.

 

 

 

 

 

 

 

 

반응형
Posted by J-sean
:
반응형

C# WinForm 으로 구글 클라우드 비전 API 결과를 확인해 보자. 아래 링크를 참고해 기본적인 구글 클라우드 비전 API 사용 준비를 한다.

2022.02.11 - [C#] - C# Google Cloud Vision API - 구글 클라우드 비전 API 1

 

Visual Studio - NuGet Package Manager에서 Google.Cloud.Vision.V1을 설치한다.

 

PictureBox, Button을 적당히 배치한다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
 
using System.IO;
using Google.Cloud.Vision.V1;
 
namespace WindowsFormsApp1
{
    public partial class Form1 : Form
    {
        ImageAnnotatorClient client;
 
        public Form1()
        {
            InitializeComponent();
 
            try
            {                
                client = new ImageAnnotatorClientBuilder
                {
                    CredentialsPath = "./values-324913-58dd97f8b8ec.json"                    
                }.Build();
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
                Close();
            }
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
            try
            {
                System.Drawing.Image systemImage;
 
                OpenFileDialog dlg = new OpenFileDialog();
                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    systemImage = System.Drawing.Image.FromFile(dlg.FileName);
                    pictureBox1.Image = systemImage;
 
                    pictureBox1.Refresh();
                    //Forces the control to invalidate its client area and immediately redraw itself and any child controls.
                    // 미리 Refresh()를 호출하지 않으면 아래 얼굴 영역 사각형, 신뢰도 텍스트 출력이 보이지 않는다.
 
                    Graphics graphics = pictureBox1.CreateGraphics();
 
                    Google.Cloud.Vision.V1.Image visionImage = Google.Cloud.Vision.V1.Image.FromFile(dlg.FileName);
                    //MemoryStream memoryStream = new MemoryStream();
                    //pictureBox1.Image.Save(memoryStream, System.Drawing.Imaging.ImageFormat.Png);
                    //Google.Cloud.Vision.V1.Image visionImage = Google.Cloud.Vision.V1.Image.FromBytes(memoryStream.ToArray());                    
                    // Google.Cloud.Vision.V1.Image와 System.Drawing.Image는 서로 호환되지 않는다.
                    
                    IReadOnlyList<FaceAnnotation> result = client.DetectFaces(visionImage);
                    foreach (FaceAnnotation face in result)
                    {
                        Google.Protobuf.Collections.RepeatedField<Vertex> vertices = face.BoundingPoly.Vertices;
                        
                        Rectangle rectangle = new Rectangle(vertices[0].X, vertices[0].Y, vertices[2].X - vertices[0].X,
                            vertices[2].Y - vertices[0].Y);
                        // 얼굴 영역 (vertices[0]: 좌상단, vertices[1]:우상단, vertices[2]:우하단, vertices[3]:좌하단)
                        StringFormat stringFormat = new StringFormat
                        {
                            Alignment = StringAlignment.Center,
                            LineAlignment = StringAlignment.Center
                        };
                        // 신뢰도 문자열 센터 정렬
 
                        graphics.DrawRectangle(System.Drawing.Pens.Red, rectangle);
                        graphics.DrawString($"Confidence: {(int)(face.DetectionConfidence * 100)}%", Font,
                            Brushes.Red, rectangle, stringFormat);
                    }
 
                    graphics.Dispose();
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.Message);
            }
        }
    }
}
 

 

소스를 입력하고 빌드한다.

 

버튼을 클릭하고 이미지 파일을 불러온다.

 

 

불러온 이미지의 얼굴 영역에 사각형과 신뢰도가 표시된다.

 

얼굴 이미지가 잘리거나 명확하지 않으면 제대로 검출되지 않는다.

 

반응형
Posted by J-sean
:
반응형

C#에서 구글 클라우드 비전 API를 사용해 보자.

 

Google Could Platform - APIs&amp;amp;amp;Services 에서 Cloud Vision API를 활성화(Enable)한다.

 

Service account key를 생성하고 JSON파일로 다운로드한다.

 

Visual Studio - NuGet Package Manager에서 Google.Cloud.Vision.V1을 설치한다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
using System.IO;
using Google.Cloud.Vision.V1;
 
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Image image = Image.FromFile("./barbara.png");
                string credentialsString = File.ReadAllText("./your_jsoncredentials.json");
 
                ImageAnnotatorClient client = new ImageAnnotatorClientBuilder
                {
                    JsonCredentials = credentialsString
                    //CredentialsPath = "./your_jsoncredentials.json"
                    // 간단히 CredentialsPath에 서비스 계정 키(json) 파일을 직접 대입해도 된다.
                }.Build();
 
                IReadOnlyList<FaceAnnotation> result = client.DetectFaces(image);
                foreach (FaceAnnotation face in result)
                {
                    string poly = string.Join(" - ", face.BoundingPoly.Vertices.Select(v => $"({v.X}, {v.Y})"));
                    Console.WriteLine($"Confidence: {(int)(face.DetectionConfidence * 100)}%; BoundingPoly: {poly}");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
}
 

 

소스를 입력하고 빌드한다.

 

 

분석 이미지

 

분석 이미지의 얼굴 좌표와 신뢰도가 함께 표시된다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
 
using Google.Cloud.Vision.V1;
using Newtonsoft.Json;
 
namespace ConsoleApp1
{
    class Program
    {
        static void Main(string[] args)
        {
            try
            {
                Image image = Image.FromFile("./barbara.png");
                Credentials credentials = new Credentials
                {
                    type = "your_type",
                    project_id = "your_project_id",
                    private_key_id = "your_key_id",
                    private_key = "-----BEGIN PRIVATE KEY-----your_key-----END PRIVATE KEY-----\n",
                    client_email = "your_email",
                    client_id = "your_client_id",
                    auth_uri = "your_auth_uri",
                    token_uri = "your_token_uri",
                    auth_provider_x509_cert_url = "your_auth_cert_url",
                    client_x509_cert_url = "your_client_cert_url"
                };
 
                ImageAnnotatorClient client = new ImageAnnotatorClientBuilder
                {
                    JsonCredentials = JsonConvert.SerializeObject(credentials)
 
                }.Build();
 
                IReadOnlyList<FaceAnnotation> result = client.DetectFaces(image);
                foreach (FaceAnnotation face in result)
                {
                    string poly = string.Join(" - ", face.BoundingPoly.Vertices.Select(v => $"({v.X}, {v.Y})"));
                    Console.WriteLine($"Confidence: {(int)(face.DetectionConfidence * 100)}%; BoundingPoly: {poly}");
                }
            }
            catch (Exception e)
            {
                Console.WriteLine(e.Message);
            }
        }
    }
 
    class Credentials
    {
        public string type;
        public string project_id;
        public string private_key_id;
        public string private_key;
        public string client_email;
        public string client_id;
        public string auth_uri;
        public string token_uri;
        public string auth_provider_x509_cert_url;
        public string client_x509_cert_url;
    }
}
 

 

위 소스처럼 서비스 계정 키(json)의 내용을 코드에 직접 삽입 할 수도 있다.

 

※ 참고

Google.Cloud.Vision.V1

 

반응형
Posted by J-sean
:
반응형

네이버 클라우드 플랫폼의 리버스 지오코딩을 사용해 보자.

 

2022.02.05 - [Android] - Naver Geocoding For Android 안드로이드 네이버 지오코딩

위 링크를 참고해 인터넷 권한과 network_security_config 옵션을 설정한다.

 

리니어 레이아웃에 텍스트뷰와 버튼을 적당히 배치한다.

 

JSON 타입의 주소 정보를 처리하기 위해 관련 클래스를 작성한다.

주소 정보 관련 클래스는 아래 파일을 사용하자.

myapplication.zip
0.00MB

 

JSON 데이터를 처리하기 위해 gson을 추가한다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package com.example.myapplication;
 
import androidx.appcompat.app.AppCompatActivity;
 
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
 
import com.google.gson.Gson;
 
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
 
public class MainActivity extends AppCompatActivity {
 
    TextView textView;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        textView = findViewById(R.id.textView);
 
        Button button = findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        requestGeocode();
                    }
                }).start();
            }
        });
    }
 
    public void requestGeocode() {
        try {
            BufferedReader bufferedReader;
            StringBuilder stringBuilder = new StringBuilder();
            String coord = "127.1234308,37.3850143";
            String query = "https://naveropenapi.apigw.ntruss.com/map-reversegeocode/v2/gc?request=coordsToaddr&coords="
                    + coord + "&sourcecrs=epsg:4326&output=json&orders=roadaddr&output=xml";
            URL url = new URL(query);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            if (conn != null) {
                conn.setConnectTimeout(5000);
                conn.setReadTimeout(5000);
                conn.setRequestMethod("GET");
                conn.setRequestProperty("X-NCP-APIGW-API-KEY-ID""Client ID");
                conn.setRequestProperty("X-NCP-APIGW-API-KEY""Client Secret");
                conn.setDoInput(true);
 
                int responseCode = conn.getResponseCode();
 
                if (responseCode == 200) {
                    bufferedReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                } else {
                    bufferedReader = new BufferedReader(new InputStreamReader(conn.getErrorStream()));
                }
 
                String line = null;
                while ((line = bufferedReader.readLine()) != null) {
                    stringBuilder.append(line + "\n");
                }
                //textView.setText(stringBuilder);
 
                Gson gson = new Gson();
                Address address = gson.fromJson(String.valueOf(stringBuilder), Address.class);
 
                String finalAddress = null;
                finalAddress = address.results[0].region.area1.name;
                finalAddress += address.results[0].region.area2.name;
                finalAddress += address.results[0].region.area3.name;
                finalAddress += address.results[0].region.area4.name;
                finalAddress += address.results[0].land.addition0.value;
 
                textView.setText(finalAddress);
 
                bufferedReader.close();
                conn.disconnect();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 

 

소스를 입력하고 빌드한다. 주소로 변환할 GPS 좌표는 (127.1234308, 37.3850143) 이다.

 

 

앱을 실행하고 버튼을 터치하면 GPS 좌표가 주소로 변환되어 표시된다.

아래와 같은 양식의 curl 명령으로도 같은 JSON 데이터를 얻을 수 있다.

curl "https://naveropenapi.apigw.ntruss.com/map-reversegeocode/v2/gc?request=coordsToaddr&coords=127.1234308,37.3850143&sourcecrs=epsg:4326&output=json&orders=roadaddr&output=xml" -H "X-NCP-APIGW-API-KEY-ID: Client ID" -H "X-NCP-APIGW-API-KEY: Client Secret" -v

-v, --verbose
Makes curl verbose during the operation. Useful for debugging and seeing what's going on "under the hood". A line starting with '>' means "header data" sent by curl, '<' means "header data" received by curl that is hidden in normal cases, and a line starting with '*' means additional info provided by curl.

If you only want HTTP headers in the output, --include might be the option you are looking for.
If you think this option still does not give you enough details, consider using --trace or --trace-ascii instead.
This option is global and does not need to be specified for each use of -:, --next.
Use --silent to make curl really quiet.
Example:
 curl --verbose https://example.com

 

반응형
Posted by J-sean
:
반응형

네이버 클라우드 플랫폼의 지오코딩을 사용해 보자.

 

xml 리소스 폴더를 만들고 network_security_config.xml 파일을 생성한다.

 

AndroidManifest.xml에 인터넷 권한과 networkSecurityConfig 옵션을 추가한다.

 

리니어 레이아웃에 텍스트뷰와 버튼을 적당히 배치한다.

 

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package com.example.myapplication;
 
import androidx.appcompat.app.AppCompatActivity;
 
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
 
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.URLEncoder;
 
public class MainActivity extends AppCompatActivity {
 
    TextView textView;
 
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
 
        textView = findViewById(R.id.textView);
 
        Button button = findViewById(R.id.button);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        requestGeocode();
                    }
                }).start();
            }
        });
    }
 
    public void requestGeocode() {
        try {
            BufferedReader bufferedReader;
            StringBuilder stringBuilder = new StringBuilder();
            String addr = "분당구 성남대로 601";
            String query = "https://naveropenapi.apigw.ntruss.com/map-geocode/v2/geocode?query=" + URLEncoder.encode(addr, "UTF-8");
            URL url = new URL(query);
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            if (conn != null) {
                conn.setConnectTimeout(5000);
                conn.setReadTimeout(5000);
                conn.setRequestMethod("GET");
                conn.setRequestProperty("X-NCP-APIGW-API-KEY-ID""Client ID");
                conn.setRequestProperty("X-NCP-APIGW-API-KEY""Client Secret");
                conn.setDoInput(true);
 
                int responseCode = conn.getResponseCode();
 
                if (responseCode == 200) {
                    bufferedReader = new BufferedReader(new InputStreamReader(conn.getInputStream()));
                } else {
                    bufferedReader = new BufferedReader(new InputStreamReader(conn.getErrorStream()));
                }
 
                String line = null;
                while ((line = bufferedReader.readLine()) != null) {
                    stringBuilder.append(line + "\n");
                }
                //textView.setText(stringBuilder);
 
                int indexFirst;
                int indexLast;
 
                indexFirst = stringBuilder.indexOf("\"x\":\"");
                indexLast = stringBuilder.indexOf("\",\"y\":");
                String x = stringBuilder.substring(indexFirst + 5, indexLast);
 
                indexFirst = stringBuilder.indexOf("\"y\":\"");
                indexLast = stringBuilder.indexOf("\",\"distance\":");
                String y = stringBuilder.substring(indexFirst + 5, indexLast);
 
                textView.setText("X: " + x + ", " + "Y: " + y);
 
                bufferedReader.close();
                conn.disconnect();
            }
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
 

 

MainActivity.java에 위 소스를 입력하고 빌드한다. '분당구 성남대로 601'의 주소 정보를 여러가지 데이터가 포함된 JSON 포맷으로 가져와 간단한 문자열 조작으로 GPS 좌표만 추출한다.

 

 

앱을 실행시키고 버튼을 터치하면 '분당구 성남대로 601'의 GPS 좌표가 표시된다.

 

구글 맵에서 GPS 좌표를 확인해 보자. 서현역이다.

 

아래와 같은 양식의 curl 명령으로도 동일한 JSON 데이터를 얻을 수 있다.

curl -G "https://naveropenapi.apigw.ntruss.com/map-geocode/v2/geocode?query=%EB%B6%84%EB%8B%B9%EA%B5%AC%20%EC%84%B1%EB%82%A8%EB%8C%80%EB%A1%9C%20601" -H "X-NCP-APIGW-API-KEY-ID: Client ID" -H "X-NCP-APIGW-API-KEY: Client Secret"

※ query에는 주소를 url encoding한 값을 대입한다.

분당구 성남대로 601 = %EB%B6%84%EB%8B%B9%EA%B5%AC%20%EC%84%B1%EB%82%A8%EB%8C%80%EB%A1%9C%20601

 

아래와 같은 양식으로 웹브라우저 주소창에 입력해도 동일한 JSON 데이터를 얻을 수 있다.

https://naveropenapi.apigw.ntruss.com/map-geocode/v2/geocode?query=분당구 성남대로 601&X-NCP-APIGW-API-KEY-ID=[Client ID]&X-NCP-APIGW-API-KEY=[Client Secret]

 

 

반응형
Posted by J-sean
:
반응형

네이버 클라우드 플랫폼에서 제공하는 지도 서비스를 이용해 안드로이드 앱을 만들어 보자.

 

Empty Activity를 선택하고 프로젝트를 만든다.

 

settings.gradle에 저장소를 추가한다.

 

build.gradle에 네이버 지도 SDK 의존성을 추가한다.

 

Sync Now를 클릭한다.

 

 

AndroidManifest.xml에 클라이언트 ID를 지정한다.

 

앱 레이아웃에 MapFragment를 추가한다.

 

빌드하고 실행하면 기본 위치의 지도가 표시된다.

 

MainActivity.java의 onCreate()를 수정하고 onMapReady()를 추가한다.

 

 

빌드하고 실행하면 원하는 위치의 지도가 표시된다.

 

반응형
Posted by J-sean
:
반응형

Google Cloud Platform(GCP) 의 무료 프로그램을 이용하면 간단한 리눅스 서버를 만들 수 있다.

 

2019.10.11 - [Linux] - Google Cloud Platform Always Free Linux Web Server 구글 클라우드 플랫폼으로 무료 리눅스 웹서버 만들기

 

위 링크의 예전 방법과 비슷하지만 무료 프로그램 조건이 약간 변경 되었다.

 

GCP - Compute Engine - VM instances를 클릭한다.

 

CREATE INSTANCE를 클릭한다.

 

우선 무료 Compute Engine의 조건을 확인해 보자.

Google Cloud 무료 프로그램

 

 

무료 프로그램 조건에 맞게 설정하고 Create 버튼을 클릭한다.

  • Name: 원하는 이름으로 지정한다.
  • Region: 아래 목록중 하나를 선택한다.
    - Oregon: us-west1
    - Iowa: us-central1
    - South Carolina: us-east1
  • Machine family: General-purpose
  • Series: E2
  • Machine type: e2-micro (2 vCPU, 1 GB memory)
  • Boot disk: standard persistent disk로 최대 30GB 까지 선택 가능.
  • Firewall: 웹서버를 설치한다면 Allow HTTP/HTTPS traffic을 선택한다.

 

Instance가 생성 되었다. Connect - SSH 를 클릭한다.

 

생성된 Instance에 연결 되었다.

 

반응형
Posted by J-sean
:
반응형

구글 클라우드 플랫폼으로 간단한 무료 웹 서버를 만들 수 있다.

 

2021.09.04 - [Linux] - GCP Compute Engine - 구글 클라우드 컴퓨트 엔진

 

 

 

구글 클라우드 플렛폼에 가입한다.

 

왼쪽 메뉴에서 Compute Engine - VM 인스턴스를 클릭한다.

 

만들기를 클릭한다.

 

무료로 만들 수 있는 Compute Engine은 위와 같은 조건이 있지만 간단한 웹서버를 만들기에는 충분한 조건이다.

 

 

 

원하는 이름을 지정한다. 지역은 오리건, 머신 유형은 f1-micro, 부팅 디스크는 30GB 표준 영구 디스크에 CentOS 8 로 설정 했다.

방화벽에 HTTP 트래픽 허용, HTTPS 트래픽 허용을 체크하고 만들기 버튼을 클릭한다.

 

VM 인스턴스에 sean-server가 생성 되었다. 연결 - SSH를 클릭한다.

 

CentOS Linux에 SSH로 연결 되었다. Apache등을 설치하고 서버로 만들어 준다.

 

2019/10/08 - [Software/Linux] - Build your own web server with Fedora linux - 페도라 리눅스로 간단한 웹서버 만들기

 

 

반응형
Posted by J-sean
: