backup and recovery approach using AWS

Durability
Use 99.999999999% durability of safe storage of data provided by Amazon S3.

Security
Use flexible access control applicable to data transfer and storage and various encryption options.

Global infrastructure
Since it can be used all over the world, will use regions that comply with organization’s compliance requirements, local laws and regulations, standards etc.

Compliance
Since AWS complies with various security standards around the world including SOC, ISO 27001, PCI DSS, etc., it is possible to easily match the backup mechanism to existing compliance standards.

Scalability
Since a storage area that automatically changes according to the size of the backup data is provided, there is no need to manage the storage capacity

Reduced TCO
By using full managed services, operation costs are reduced, leading to a reduction in the total cost of ownership(TCO) of backup storage.

Price based on metered basis
Since it is a usage fee based on the used capacity and duration, a life cycle plan is set so that only data necessary for backup and recovery plan is saved.

The features of “classmethod”

https://classmethod.jp/

Described on the homepage that aws professional group solves the problem.

When examining company information, first of all it is a habit to see employment information.

First view shows project manager, aws integration.

Job detail
What kind of work do you do?
As a project manager, we will do project promotion in general. We will promote a series of work such as progress management and quality control from the planning and agreement of the project with the engineers and partners in the company.

Also, for customers who have already installed AWS, as an account manager as well as sales, we think about further use of AWS to solve problems of customers and solve business problems, and we will help you decide policy.

What kind of human resources are you looking for?
Those who have a strong will to make the project successful with customers. If problems occur, do not hold them alone, those who can deal with organizations and team involvement.

Wow, what engineer are doing is roughly the same with other places.

AWS operational design consultant
– Operational design work of service built by our company or customer
– Proposal of labor saving, automation by combining various services of AWS
– Support for operational design in order to acquire certification of our company or customer service.

With aws design, you have to understand aws in a great deal of detail.

Is not it listed? want to invest lol

AWS codedeploy

CodeDeploy is a managed service of AWS and can deploy source code and build artifacts for EC2 and on-premises servers and Lambda.

You can choose between in-place deployment and Blue / Green deployment to deploy to EC2 and on-premises servers.

You can select the source of the distribution from S3 and GitHub, but it will inevitably become s3 because the extension must be zip, tar, and tar.gz.

It is appsepec.yml that determines the rules for these deployment. Either type of appspeck.yml is required.

First of all, the content of the sample.zip file being uploaded to s3 are as follows. Assume that sample.jar is already built and star.sh describes the command to start it.

sample.zip
├── appspec.yml
├── sample.jar
└── start.sh

Travis CI push to S3

Precondition
– an account of GitHub
– a repository in GitHub
– an account of Travis CI
– Travis CI CLI installed (gem install travis)
– AWS account
– making an access ID and Secret Key with updated authority of S3 with IAM
– hosting buckets of S3 as static site

Create IAM User

GitHub

As an access key and a secret key are to be replaced later, is it OK?

language: php
php:
- 5.5
script: echo "do nothing"
deploy:
  provider: s3
  access_key_id:
    secure: "accesskey id"
  secret_access_key:
    secure: "secret access key"
  bucket: travisci-s3
  region: ap-northeast-1
  endpoint: s3.amazonaws.com
  on:
    branch: master

Perform a simple test with PHPUnit

I already tried installing PHPUnit, so I will try simple samples.

message.php

class Message
{
	private $message;
	public function __construct(string $message){
		$this->message = $message;
	}

	public function get(){
		return $this->message;
	}
}

messageTest.php

require_once ('../vendor/autoload.php');
require_once (dirname(__FILE__) .'../src/message.php');

use PHPUnit\Framework\TestCase;

class MessageTest extends TestCase{
	public function testGet(){
		$message = new Message('hello, world');
		$this->assertEquals('hello, world', $message->get());
	}
}

command line
[vagrant@localhost app]$ vendor/bin/phpunit tests
PHP Warning: require_once(../vendor/autoload.php): failed to open stream: No such file or directory in /home/vagrant/local/app/tests/messageTest.php on line 3
PHP Fatal error: require_once(): Failed opening required ‘../vendor/autoload.php’ (include_path=’.:/usr/share/pear:/usr/share/php’) in /home/vagrant/local/app/tests/messageTest.php on line 3

fix

require_once ('./vendor/autoload.php');
require_once ('./src/message.php');

use PHPUnit\Framework\TestCase;

class MessageTest extends TestCase{
	public function testGet(){
		$message = new Message('hello, world');
		$this->assertEquals('hello, world', $message->get());
	}
}

[vagrant@localhost app]$ vendor/bin/phpunit tests
PHPUnit 7.1.4 by Sebastian Bergmann and contributors.

. 1 / 1 (100%)

Time: 35 ms, Memory: 4.00MB

OK (1 test, 1 assertion)

ohhhhhhhhhhhhhhhhhhhhhhhhhhhhhhh^^

/usr/local/bin

Although the way of thinking differs depending on the operating system, in general /usr/local and below, it is used to keep compiled oneself.

/usr/bin and /bin put the standard command of the system, but place other thing in /usr/local/bin.

[vagrant@localhost app]$ echo $PATH
/home/vagrant/.pyenv/plugins/pyenv-virtualenv/shims:/home/vagrant/.pyenv/shims:/home/vagrant/.pyenv/bin:/home/vagrant/.rbenv/shims:/home/vagrant/.rbenv/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/vagrant/bin

u, that’s strange..

What is PHPUnit

Unit test is a test to check the operation in units such as classes and functions that are the constituent elements of the program. By using PHPUnit, it is possible to create a unit test procedure as a PHP program and execute it as a batch process from a command line or the like.

Speaking of PHP program testing, it is common to manually check the screen transition by manipulating the browser manually, enter values in the form and check the result with the eyes. However, it is quite tedious task to open the page many times during development, enter the test data in the same way, and manually do all the results correctly.

The advantage of using PHPUnit that can automate and repetitively execute troublesome test procedures manually.

Since you can run the test as many times as you like with a single command, you can improve test efficiency and eliminate manual errors as well. In addition, the created test program replaces the specifications, confirming that existing process works correctly in the process of continually improving the program, so-called “degrate” it can also be used to prevent. It can lead to maintenance and improvement of program quality.

class Hello
{
	public function getMessage()
	{
		return "Hello world";
	}
}

It assumes that composer is already installed.
[vagrant@localhost app]$ php composer.phar require phpunit/phpunit:7.1.4
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 29 installs, 0 updates, 0 removals
– Installing sebastian/version (2.0.1): Loading from cache
– Installing sebastian/resource-operations (1.0.0): Loading from cache
– Installing sebastian/recursion-context (3.0.0): Loading from cache
– Installing sebastian/object-reflector (1.1.1): Loading from cache
– Installing sebastian/object-enumerator (3.0.3): Loading from cache
– Installing sebastian/global-state (2.0.0): Loading from cache
– Installing sebastian/exporter (3.1.0): Loading from cache
– Installing sebastian/environment (3.1.0): Loading from cache
– Installing sebastian/diff (3.0.1): Loading from cache
– Installing sebastian/comparator (3.0.2): Loading from cache
– Installing doctrine/instantiator (1.1.0): Loading from cache
– Installing phpunit/php-text-template (1.2.1): Loading from cache
– Installing phpunit/phpunit-mock-objects (6.1.2): Downloading (100%)
– Installing phpunit/php-timer (2.0.0): Loading from cache
– Installing phpunit/php-file-iterator (1.4.5): Downloading (100%)
– Installing theseer/tokenizer (1.1.0): Loading from cache
– Installing sebastian/code-unit-reverse-lookup (1.0.1): Loading from cache
– Installing phpunit/php-token-stream (3.0.1): Downloading (100%)
– Installing phpunit/php-code-coverage (6.0.5): Downloading (100%)
– Installing symfony/polyfill-ctype (v1.10.0): Loading from cache
– Installing webmozart/assert (1.4.0): Downloading (100%)
– Installing phpdocumentor/reflection-common (1.0.1): Loading from cache
– Installing phpdocumentor/type-resolver (0.4.0): Loading from cache
– Installing phpdocumentor/reflection-docblock (4.3.0): Loading from cache
– Installing phpspec/prophecy (1.8.0): Loading from cache
– Installing phar-io/version (1.0.1): Downloading (100%)
– Installing phar-io/manifest (1.0.1): Downloading (100%)
– Installing myclabs/deep-copy (1.8.1): Loading from cache
– Installing phpunit/phpunit (7.1.4): Downloading (100%)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/phpunit-mock-objects suggests installing ext-soap (*)
phpunit/php-code-coverage suggests installing ext-xdebug (^2.6.0)
phpunit/phpunit suggests installing phpunit/php-invoker (^2.0)
phpunit/phpunit suggests installing ext-xdebug (*)
Writing lock file
Generating autoload files

[vagrant@localhost app]$ vendor/bin/phpunit –version
PHPUnit 7.1.4 by Sebastian Bergmann and contributors.

What!?

Nest step, the path to use the phpunit command.

csv.z file

A file with the Z file extension is a UNIX compressed file. Like other archive file formats, Z file are used to compress a file for backup/archive purposes. However, unlike more complex formats, Z files can store just one file and no folders.

Z files can be opened with most zip/unzip programs.
Unix system can decompress .Z file without any software by using this command, where “name.z” is the name of the .Z file so as csv.z

Unix zcat command

It is a command that can be used on Unix system.
Display the contents of the compressed file with “gzip” command
Display the contents of the compressed file with “compress” command

Use it when displaying the contents of the compressed file!

linux chown command

The chown command changes user ownership(owner) and group ownership(group) of specified files and directories. User ownership is specified by user name or user ID, and group ownership is specified by group name or group ID.

Change user ownership. First, check user ownership and group ownership with “ls command”.
[vagrant@localhost symbolic]$ ls -l
合計 4
drwxr-xr-x 2 vagrant vagrant 4096 1月 27 20:32 2019 backupdir
lrwxrwxrwx 1 vagrant vagrant 10 1月 27 16:51 2019 latest -> text03.txt
lrwxrwxrwx 1 vagrant vagrant 12 1月 27 16:47 2019 latest~ -> mylist02.txt
-rw-rw-r– 1 vagrant vagrant 0 1月 27 16:43 2019 mylist01.txt
-rw-rw-r– 1 vagrant vagrant 0 1月 27 16:43 2019 mylist02.txt
-rw-rw-r– 1 vagrant vagrant 0 1月 27 16:50 2019 mylist03.txt

User ownership is “vagrant”, group ownership is also “vagrant”.

Change user ownership
Try changing the user ownership from “vagrant” to “root” without specifying a group. Execute the chown command as follows.

[vagrant@localhost symbolic]$ chown root mylist01.txt
chown: `mylist01.txt’ の所有権を変更中: 許可されていない操作です

It seems that root privilege is requried for chown execution.

[vagrant@localhost symbolic]$ sudo chown root mylist01.txt
[vagrant@localhost symbolic]$ ls -l mylist01.txt
-rw-rw-r– 1 root vagrant 0 1月 27 16:43 2019 mylist01.txt

Change user ownership and group ownership
Specify users and groups, and execute chown command. Between the users and the group, put : (semicolon).

[vagrant@localhost symbolic]$ sudo chown root:root mylist02.txt
[vagrant@localhost symbolic]$ ls -l mylist02.txt
-rw-rw-r– 1 root root 0 1月 27 16:43 2019 mylist02.txt

Directory ownership
To change directory ownership recursively, use option -R.

[vagrant@localhost app]$ sudo chown -hR root:root symbolic