php zip

インストール済みを確認します。
[vagrant@localhost ~]$ yum list installed | grep zip
bzip2.x86_64 1.0.5-7.el6_0 @anaconda-CentOS-201605220104.x86_64/6.8
bzip2-devel.x86_64 1.0.5-7.el6_0 @base
bzip2-libs.x86_64 1.0.5-7.el6_0 @anaconda-CentOS-201605220104.x86_64/6.8
gzip.x86_64 1.3.12-24.el6 @base
libzip5.x86_64 1.5.2-1.el6.remi @remi-safe
php-pecl-zip.x86_64 1.15.3-1.el6.remi.7.1 @remi-php71
unzip.x86_64 6.0-5.el6 @base

ん?
php-pecl-zipか??

[vagrant@localhost ~]$ php –ri zip

zip

Zip => enabled
Zip version => 1.15.3
Libzip headers version => 1.5.1
Libzip library version => 1.5.2

はいってるっぽいですね。
これのこと?

php70-zipとphp-pecl-zipの違いが分からんぞ。

SFTP(SSH File Transfer Protocol)とは

What is SFTP?
A protocol that encrypts information transferred by FTP using “SSH(Secure Shell)”.

SSH?
A protocol that encrypts all information communicated when operating a remote server from a terminal.

“SSH” can be used with “OpenSSH” software etc. It is installed by default in Linux. Windows can also be used with “Cygwin”, “WinSCP”, or “Git Bash” bundled with Git. In any case, an environment where “SSH” can be used is required.

あれ、なんや、基本っぽいな。

古いCloudFront APIバージョンの廃止

古いCloudFront APIバージョンの廃止があるらしい。

Full list of versions to be deprecated on June 6, 2019:
2008-06-30, 2009-04-02, 2009-09-09, 2009-12-01, 2010-03-01, 2010-05-01, 2010-06-01, 2010-07-15, 2010-08-01,  2010-11-01, 2012-03-15, 2012-05-05,  2012-07-01, 2013-05-12, 2013-08-26, 2013-09-27, 2013-11-11, 2013-11-22, 2014-01-31, 2014-05-31, 2014-08-31, 2014-10-21,  2014-11-06, 2015-04-17, 2015-07-27, 2015-09-17, 2015-12-22

For more information regarding this deprecation and the actions you should take, refer to our Developer Forum post here:
https://forums.aws.amazon.com/ann.jspa?annID=6697

で、CloudFrontを使っているから、って調べていたんだが、CloudFrontとCloudFront APIは違うんだね。すげー勘違いしていた。。。CloudFront APIは、その名の通り、CloudFrontにAPI接続する仕様。

<script src="https://sdk.amazonaws.com/js/aws-sdk-2.316.0.min.js"></script>
<script>
var config = new AWS.Config({
	accessKeyId : xxxxxxxxxxxxxxx,
	secretAccessKey : xxxxxxxxxxxxxxx,
	region : xxxxxxxxxxxx
});
cloudfront = new AWS.CloudFront(config)
</script>

うーん、なんだかなー

CloudFormationを書いていこう

{
	"AWSTemplateFormatVersion" : "2010-09-09",

	"Description" : "Test template.",

	"Resources" : {

		"VPC" : {
			"Type" : "AWS::EC2::VPC",
			"Properties" : {
				"CidrBlock" : "10.0.0.0/16",
				"Tags" : [{"Key": "Application", "Value" : {"Ref" : "AWS::StackId"} }]
			}
		},

		"PublicSubnet" : {
			"Type" : "AWS::EC2::Subnet",
			"Properties" : {
				"VpcId" : {"Ref" : "VPC" },
				"CidrBlock" : "10.0.0.0/24",
				"Tags" : [{"Key" : "Application", "Value" : { "Ref" : "AWS::StackId"}}]
			}
		},

		"PrivateSubnet" : {
			"Type" : "AWS::EC2::Subnet",
			"Properties" : {
				"VpcId" : {"Ref" : "VPC"},
				"CidrBlock" : "10.0.1.0/24",
				"Tags" : [{"Key": "Application", "Value" : {"Ref": "AWS::StackId"}}]
			}
		},

		"InternetGateway" : {
			"Type" : "AWS::EC2::InternetGateway",
			"Properties" : {
				"Tags" : [ {"Key" : "Application", "Value" : {"Ref" : "AWS::StackId"}}]
			}
		},

		"AttachGateway" : {
			"Type" : "AWS::EC2::VPCGatewayAttachment",
			"Properties" : {
				"VpcId" : {"Ref": "VPC"},
				"InternetGatewayId" : {"Ref" : "InternetGateway"}
			}
		},

		"RouteTable" : {
			"Type" : "AWS::EC2::RouteTable",
			"Properties" : {
				"VpcId" : {"Ref" : "VPC"},
				"Tags" : [{"Key" : "Application", "Value" : {"Ref" : "AWS::StackId"}}]
			}
		},

		"Route" : {
			"Type" : "AWS::EC2::Route",
			"DependsOn" : "AttachGateway",
			"Properties" : {
				"RouteTableId" : {"Ref" : "RouteTable"},
				"DestinationCidrBlock": "0.0.0.0/0",
				"GatewayId" : {"Ref" : "InternetGateway"}
			}
		},

		"SubnetRouteTableAssociation" : {
			"Type" : "AWS::EC2::SubnetRouteTableAssociation",
			"Properties" : {
				"SubnetId" : {"Ref" : "PublicSubnet"},
				"RouteTableId" : {"Ref" : "RouteTable"}
			}
		},

		"NetworkAcl" : {
			"Type" : "AWS::EC2::NetworkAcl",
			"Properties" : {
				"VpcId" : {"Ref" : "VPC"},
				"Tags" : [ {"Key" : "Application", "Value": {"Ref" : "AWS::StackId"}}]
			}
		},

		"SubnetNetworkAclAssociation" : {
			"Type" : "AWS::EC2::SubnetNetworkAclAssociation",
			"Properties" : {
				"SubnetId" : {"Ref" : "PublicSubnet" },
				"NetworkAclId" : {"Ref" : "NetworkAcl"}
			}
		}
	}
}

なんじゃこりゃーーーーーーーーーーーー
エンジニアってどうやってモチベーション保ってんだろう。。
まったく、意味が分からんよ。

CentOSにaws cliをインストールする

公式を参考にします。
LinuxにAWS CLIをインストールする

[vagrant@localhost ~]$ aws –version
-bash: aws: コマンドが見つかりません
[vagrant@localhost ~]$ pip3 –version
pip 18.0 from /home/vagrant/.pyenv/versions/3.5.2/lib/python3.5/site-packages/pip (python 3.5)
[vagrant@localhost ~]$ python3 –version
Python 3.5.2

pip3は入ってます。インストールしていきます。

[vagrant@localhost ~]$ pip3 install awscli –upgrade –user
Installing collected packages: botocore, s3transfer, awscli
Found existing installation: botocore 1.12.86
Uninstalling botocore-1.12.86:
Successfully uninstalled botocore-1.12.86
Found existing installation: s3transfer 0.1.13
Uninstalling s3transfer-0.1.13:
Successfully uninstalled s3transfer-0.1.13
Found existing installation: awscli 1.16.96
Uninstalling awscli-1.16.96:
Successfully uninstalled awscli-1.16.96
Successfully installed awscli-1.16.198 botocore-1.12.188 s3transfer-0.2.1

[vagrant@localhost ~]$ aws –version
-bash: aws: コマンドが見つかりません
successfully installedとなっているのに、なぜ?

[vagrant@localhost ~]$ which aws
/usr/bin/which: no aws in (/home/vagrant/.pyenv/plugins/pyenv-virtualenv/shims:/home/vagrant/.pyenv/shims:/home/vagrant/.pyenv/bin:/home/vagrant/.rbenv/shims:/home/vagrant/.rbenv/bin:/home/vagrant/.nvm/versions/node/v10.7.0/bin:/usr/local/bin:/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/sbin:/home/vagrant/bin)
[vagrant@localhost ~]$ which python
~/.pyenv/shims/python

なんでだろー、わからん。。

AWS CloudFormation

AWS CloudFormation is a service that help you model and set up Amazon Web Services resources. You can spend less time managing resources and focus more on the applications that run on AWS. If you create a template that describes all of the AWS resources that you wan to use, such as Amazon EC2 instances or Amazon RDS DB instances, AWS CloudFormation will be responsible for provisioning and configuring these resources on your behalf. You don’t have to create and design individual AWS resources and think about their dependencies. AWS CloudFormation handles everything.

{
	"AWSTempleteFormatVersion": "2010-09-09",

	"Description": "CloudFormation tutorial",

	"Resources" : {
	  "InstanceSecurityGroup": {
	     "Type": "AWS::EC2::SecurityGroup",
	     "Properties": {
	         "GroupDescription" : "Enable HTTP Access on the configured port",
	         "securityGroupIngress" : [
	            {"IpProtocol": "tcp", "FromPort":"80", "ToPort":"80","CidrIp":"0.0.0.0/0"}
	         ]
	     }
	  }
	}
}

Q&Aの見出しをCCSで装飾(邪道?)

[ccs]
#qa dt .q {
padding:2px 5px 2px 5px;
background-color:orangered;
color:#fff;
margin-right:5px;
}
#qa dd .a {
padding:2px 5px 2px 5px;
background-color:orangered;
color:#fff;
margin-right:5px;
}
[/ccs]

邪道かな。やっぱimgでやるべきか。。

split brain

Originally, if either is a primary aircraft, the other must be a secondary aircraft, but both are primary aircraft.

In this way, a situation where multiple primary machine exist when a cluster is split is called split brain. If data is updated in this state, data inconsistencies may occur.

Why does split brain occur?
-> Split brain is mainly caused by network failure between the first and second units.

key

>KEY は通常、INDEX のシノニムです。キー属性 PRIMARY KEY もまた、カラム定義内で指定する場合は、単に KEY として指定できます。これは、ほかのデータベースシステムとの互換性のために実装されました。
Indexって理解でOK?
->確実に 識別する(identification) ための 主たる制約

MySQL unsigned

Integer types can handle positive and negative numbers, but if the data type is followed by UNSIGNED, only 0 and positive numbers can be stored. Such data types are called unsigned integer types. For example, to make INT type unsigned, write as follows.

mysql> create table numtest(
-> num1 smallint unsigned
-> );
Query OK, 0 rows affected (0.17 sec)

mysql> insert into numtest values(5000);
Query OK, 1 row affected (0.12 sec)

mysql> insert into numtest values(-10);
Query OK, 1 row affected, 1 warning (0.03 sec)

mysql> select * from numtest;
+——+
| num1 |
+——+
| 5000 |
| 0 |
+——+
2 rows in set (0.00 sec)