생활코딩 - 아마존 웹 서비스 (AWS)
    • 01
      시작하기
    • 아마존 웹 서비스와 클라우드
      회원가입
      보안설정 - 2단계 인증
      지역과 가용구역
    • 02
      AWS EC2
    • EC2 소개
      EC2 인스턴스 타입
      EC2 가격정책
      EC2 인스턴스 장치설정
      EC2 태그와 보안그룹
      EC2 인스턴스 비밀번호 생성
      EC2 리눅스 인스턴스 접속 (OSX)
      EC2 리눅스 인스턴스 접속 (Windows)
      EC2 리눅스 인스턴스에서 웹서버 사용
      EC2 윈도우 인스턴스 접속 (OSX)
      EC2 윈도우 인스턴스 접속 (Windows)
      EC2 윈도우에서 웹서버 사용
      EC2 AMIs
      EC2 AWS Marketplace (Wordpress)
      EC2 Scalability
      EC2 Scale Up
      스트레스 테스트 준비
      스트레스 테스트 시작
      Elastic IP
      인스턴스 교체
      EC2 Scale Out
      Scale Out의 흐름
      ELB 생성
      ELB 적용
      ELB 사용 시 주의 사항
      EC2 Auto Scaling
      EC2 Auto Scaling (Launch Configuration) 생성1
      EC2 Auto Scaling (Launch Configuration) 생성2
      Auto Scaling 테스트
    • 03
      AWS SDK
    • AWS를 제어하는 방법
      PHP를 위한 AWS SDK 시작하기 1 : 준비
      PHP를 위한 AWS SDK 시작하기 2 : 코딩
      node.js 를 위한 AWS SDK
    • 04
      AWS S3
    • S3 콘솔을 통한 기본 조작 방법
      S3 소개
      PHP를 위한 S3 SDK : 파일 전송
      PHP를 위한 S3 SDK : 파일 목록 가져오기
      PHP를 위한 S3 SDK : 파일 다운로드
      PHP를 위한 S3 SDK : 웹애플리케이션에서 S3 활용
      node.js를 위한 S3 SDK : 업로드
      node.js를 위한 S3 SDK : 목록
      node.js를 위한 S3 SDK : 다운로드
      node.js 웹애플리케이션에서 s3 SDK 활용
    • 05
      AWS RDS
    • RDS 소개
      RDS 서버 생성
      RDS 백업 & 복원
      RDS Scale up & out
      PHP를 위한 RDS : 개발준비
      PHP를 위한 MySQL(MariaDB) 연동
      Read Replication
    • 06
      부록
    • php 실습환경 구축
      node.js 실습환경 구축
    php 실습환경 구축
    06 부록
    php 실습환경 구축

    최신상태로 업데이트를 합니다. 

    1
    sudo apt-get update;

    apache를 설치합니다. 

    1
    sudo apt-get install apache2

    php를 설치합니다. 

    1
    sudo apt-get install php5
    만약 RDS나 DynamoDB와 같은 서비스형 데이터베이스를 사용하실 예정이면  아래 과정은 하지 않으셔도 됩니다. 

    MySQL 데이터베이스 서버를 설치합니다. 

    1
    sudo apt-get install mysql-server

    MySQL 데이터베이스 클라이언트를 설치합니다. 

    1
    sudo apt-get install mysql-client

    데이터베이스에 정보를 입력합니다. 

    데이터베이스 생성

    1
    CREATE DATABASE opentutorials CHARACTER SET utf8 COLLATE utf8_general_ci;

    데이터베이스 선택

    1
    use opentutorials;

    테이블 생성

    1
    2
    3
    4
    5
    6
    7
    8
    CREATE TABLE `topic` (
    `id` int(11) NOT NULL AUTO_INCREMENT,
    `title` varchar(100) NOT NULL,
    `description` text NOT NULL,
    `author` varchar(30) NOT NULL,
    `created` datetime NOT NULL,
    PRIMARY KEY (id)
    ) ENGINE=InnoDB DEFAULT CHARSET=utf8;

    생성된 테이블 확인

    1
    show tables;

    데이터 삽입

    1
    2
    3
    4
    INSERT INTO `topic` (`id`, `title`, `description`, `author`, `created`) VALUES(1, 'About JavaScript', '<h3>Desctiption</h3>\r\n<p>JavaScript is a dynamic computer programming language. It is most commonly used as part of web browsers, whose implementations allow client-side scripts to interact with the user, control the browser, communicate asynchronously, and alter the document content that is displayed.</p>\r\n<p>\r\nDespite some naming, syntactic, and standard library similarities, JavaScript and Java are otherwise unrelated and have very different semantics. The syntax of JavaScript is actually derived from C, while the semantics and design are influenced by the Self and Scheme programming languages.\r\n</p>\r\n<h3>See Also</h3>\r\n<ul>\r\n <li><a href="http://en.wikipedia.org/wiki/Dynamic_HTML">Dynamic HTML and Ajax (programming)</a></li>\r\n <li><a href="http://en.wikipedia.org/wiki/Web_interoperability">Web interoperability</a></li>\r\n <li><a href="http://en.wikipedia.org/wiki/Web_accessibility">Web accessibility</a></li>\r\n</ul>\r\n', 'egoing', '2015-03-31 12:14:00');
    INSERT INTO `topic` (`id`, `title`, `description`, `author`, `created`) VALUES(2, 'Variable and Constant', '<h3>Desciption</h3>\r\n\r\nIn computer programming, a variable or scalar is a storage location paired with an associated symbolic name (an identifier), which contains some known or unknown quantity or information referred to as a value. The variable name is the usual way to reference the stored value; this separation of name and content allows the name to be used independently of the exact information it represents. The identifier in computer source code can be bound to a value during run time, and the value of the variable may thus change during the course of program execution.\r\n\r\n<h3>See Also</h3>\r\n<ul>\r\n<li>Non-local variable</li>\r\n<li>Variable interpolation</li>\r\n</ul>\r\n', 'k8805', '2015-05-14 10:04:00');
    INSERT INTO `topic` (`id`, `title`, `description`, `author`, `created`) VALUES(3, 'Opeartor', '<h2>Operator</h2>\r\n<h3>Description</h3>\r\n<p>Programming languages typically support a set of operators: constructs which behave generally like functions, but which differ syntactically or semantically from usual functions</p>\r\n<p>Common simple examples include arithmetic (addition with +, comparison with >) and logical operations (such as AND or &&). </p>\r\n', 'egoing', '2015-06-18 05:00:00');
    INSERT INTO `topic` (`id`, `title`, `description`, `author`, `created`) VALUES(4, 'Conditional', '<h3>Description</h3>\r\n<p>In computer science, conditional statements, conditional expressions and conditional constructs are features of a programming language which perform different computations or actions depending on whether a programmer-specified boolean condition evaluates to true or false. Apart from the case of branch predication, this is always achieved by selectively altering the control flow based on some condition.</p>\r\n<p>In imperative programming languages, the term "conditional statement" is usually used, whereas in functional programming, the terms "conditional expression" or "conditional construct" are preferred, because these terms all have distinct meanings.</p>\r\n<h3>See Also</h3>\r\n<ul>\r\n<li><a href="http://en.wikipedia.org/wiki/Branch_(computer_science)" title="Branch (computer science)">Branch (computer science)</a></li>\r\n<li><a href="http://en.wikipedia.org/wiki/Conditional_compilation" title="Conditional compilation">Conditional compilation</a></li>\r\n<li><a href="http://en.wikipedia.org/wiki/Dynamic_dispatch" title="Dynamic dispatch">Dynamic dispatch</a> for another way to make execution choices</li>\r\n<li><a href="http://en.wikipedia.org/wiki/McCarthy_Formalism" title="McCarthy Formalism">McCarthy Formalism</a> for history and historical references</li>\r\n<li><a href="http://en.wikipedia.org/wiki/Named_condition" title="Named condition" class="mw-redirect">Named condition</a></li>\r\n<li><a href="http://en.wikipedia.org/wiki/Test_(Unix)" title="Test (Unix)">Test (Unix)</a></li>\r\n<li><a href="http://en.wikipedia.org/wiki/Yoda_conditions" title="Yoda conditions">Yoda conditions</a></li>\r\n</ul>', 'c2', '2015-07-25 00:00:00');

    php와 mysql 연동

    1
    2
    sudo apt-get install php5-mysql;
    sudo service apache2 restart;

    샘플 애플리케이션

    1
    2
    3
    4
    5
    6
    <?php
    $conn = mysqli_connect('localhost', 'root', '', 'o2');
    $result = mysqli_query($conn, 'SELECT * FROM topic WHERE id=1');
    $row = mysqli_fetch_assoc($result);
    var_dump($row['title']);
    ?>
    Q&A