ELB http 460

What is HTTP 460 on ELB
The load balancer received a request from a client, but the client closed the connection with the load balancer before the idle timeout expired.

Check if the client timeout period is longer than the load balancer idle timeout period. Before the client timeout period expires, make sure that target returns a response to the client, or if the client supports it, increase the client timeout period to match the load balancer idle timeout.

301 redirect and 302 redirect

The 301 redirect is “permanent redirect” and “permanent transfer”, while the 302 redirect is “temporary redirect” and “temporary transfer”.

Consider that a URL set to 301 redirect will not appear in the index. However, the 301 redirect takes over the information of the transfer source (old URL) to the transfer destination (new URL).

Amazon S3のAWS署名バーション2の廃止

S3の署名バージョン2が廃止になる。

– 以前の AWS リージョンの一部では、Amazon S3 で署名バージョン 4 と署名バージョン 2 がサポート。ただし、署名バージョン 2 は廃止され、署名バージョン 2 の最終サポートは 2019 年 6 月 24 日に終了
https://docs.aws.amazon.com/ja_jp/AmazonS3/latest/dev/UsingAWSSDK.html#UsingAWSSDK-sig2-deprecation

2016年5月以前にリリースされた AWS SDK を使用する場合、次の表に示すように、署名バージョン 4 のリクエストが必要になることがある
AWS CLI

$ aws configure set default.s3.signature_version s3v4
$ aws configure set profile.your_profile_name.s3.signature_version s3v4

Java SDK

System.setProperty(SDKGlobalConfiguration.ENABLE_S3_SIGV4_SYSTEM_PROPERTY, "true");
-Dcom.amazonaws.services.s3.enableV4

JavaScript SDK

var s3 = new AWS.S3({signatureVersion: 'v4'});

PHP SDK

									
$s3 = new S3Client(['signature' => 'v4']);

Python-Boto SDK

[s3] use-sigv4 = True

Ruby SDK

s3 = AWS::S3::Client.new(:s3_signature_version => :v4)
s3 = Aws::S3::Client.new(signature_version: 'v4')

.NET SDK

AWSConfigsS3.UseSignatureVersion4 = true;

つまり、AWS SDKを使っている場合は、バージョンを確認
– AWS SDK for Java v1 →Java 1.11.x あるいは v2 in Q4 2018 にアップグレード。
– AWS SDK for Java v2 ※アップグレード不要
– AWS SDK for .NET v1 →3.1.10 以降にアップグレード
– AWS SDK for .NET v2 →3.1.10 以降にアップグレード
– AWS SDK for .NET v3 ※アップグレード不要
– AWS SDK for JavaScript v1 →主要バージョン V3 in Q3 2019 にアップグレード
– AWS SDK for JavaScript v2 →2.68.0 以降にアップグレード
– AWS SDK for JavaScript v3 →主要バージョン V3 in Q3 2019 にアップグレード
– AWS SDK for PHP v1 →主要バージョン V3 にアップグレード
– AWS SDK for PHP v2 →主要バージョン V3 にアップグレード
– AWS SDK for PHP v3 ※アップグレード不要
– Boto2 →Boto2 v2.49.0 にアップグレード
– Boto3 →1.5.71 (Botocore)、1.4.6 (Boto3) にアップグレード
– AWS CLI →1.11.108 にアップグレード
– AWS CLI v2 ※アップグレード不要
– AWS SDK for Ruby v1 →Ruby V3 にアップグレード
– AWS SDK for Ruby v2 →Ruby V3 にアップグレード
– AWS SDK for Ruby v3 ※アップグレード不要
– Go ※アップグレード不要
– C++ ※アップグレード不要

pgrep httpd

pgrep
It is a command to search for process ID using a pattern that represents process name, user group, terminal name, etc. among running processes. You can use exetnded regular expression(10th) for patterns.

You can also use the pidof command to find the process ID from the command name.

[vagrant@localhost tests]$ pgrep httpd
1779
2082
2083
2084
2085
2086
2087
2088
2089

この数字はプロセスIDですな。

ls -t

ls -t: Sort and display in time stamp order.

[vagrant@localhost tests]$ touch index.php
[vagrant@localhost tests]$ ls -t
index.php backup beforeinstall.sh codedeploy
[vagrant@localhost tests]$ ls
backup beforeinstall.sh codedeploy index.php

なるほど~
[vagrant@localhost tests]$ ls -l | tail -n+2
drwxrwxr-x 3 vagrant vagrant 4096 3月 17 20:41 2019 backup
-rwxr-xr-x 1 vagrant vagrant 422 3月 17 20:41 2019 beforeinstall.sh
drwxr-xr-x 3 vagrant vagrant 4096 3月 17 11:04 2019 codedeploy
-rw-rw-r– 1 vagrant vagrant 0 3月 18 08:36 2019 index.php

If not specified, 10 lines from the last line will be displayed, but with the -n option, the specified number of lines will be output.

[vagrant@localhost tests]$ ls -t | tail -n+1
index.php
backup
beforeinstall.sh
codedeploy
[vagrant@localhost tests]$ ls -t | tail -n+4
codedeploy
[vagrant@localhost tests]$ ls -t | tail -n+3
beforeinstall.sh
codedeploy
[vagrant@localhost tests]$ ls -t | tail -n+2
backup
beforeinstall.sh
codedeploy

にゃるほどー

shell loop(for), function, +α

#!/bin/sh

for var in 0 1 2 3 4
do
	echo $var
done

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh
0
1
2
3
4

{0..5}とも書ける。」

#!/bin/sh

for var in {0..5}
do
	echo $var
done

function

#!/bin/sh

MyFunction(){
	echo "display function"
}
MyParamFunc(){
	echo "parm1:$1 param2:$2"
}

MyFunction
MyParamFunc 5 4

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh
display function
parm1:5 param2:4

with linux command

#!/bin/sh

index=1
for file in *.txt
do
	mv "$file" "mytxt${index}.txt"
	index=`expr $index + 1`
done

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh

すげええええええええええええええええええええええええ

shell while

#!/bin/sh

a=0
while [ $a -lt 5 ]
do
	echo $a
	a=`expr $a + 1`
done

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh
0
1
2
3
4

‘と`の違いで手古摺った.

#!/bin/sh

a=0
until [ ! $a -lt 5 ]
do
	echo $a
	a=`expr $a + 1`
done

shell case

#!/bin/sh

DRINK="beer"
case "$DRINK" in
	"beer") echo "this is beer"
	;;
	"juice") echo "that is juice"
	;;
	"coak") echo "Do not drink it"
	;;
esac

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh
this is beer

esacとか、使い慣れてないなー

shell if

#!/bin/sh

if [ "$1" -gt "$2" ]
then
	echo "1番目の引数が2番目の引数より大きい"
elif [ "$1" -eq "$2" ]
then
	echo "1番目の引数と2番目の引数は同じです"
else
	echo "1番目の引数が2番目の引数より小さい"
fi

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh 5 4
1番目の引数が2番目の引数より大きい

shell special variable

Variable Function
$0 script name
Access $1 ~ $9 arguments, $1 for the first argument, $2 for the second argument

$ # number of arguments given to the script
$ * treat all arguments together as one
$ @ Thread all arguments as separate
$? End value of the last executed command (0 is success, 1 is failure)
$$ Process ID of this shell script
$! last executed background process ID

#!/bin/sh

echo "\$0 (スクリプト名): $0"
echo "\$1 (1番目の引数): $1"
echo "\$2 (2番目の引数): $2"
echo "\$# (引数の数): $#"
echo "\"\$*\": \"$*\""
echo "\"\$@\": \"$@\""
VAR="exit値は0になるはずです"
echo $?

[vagrant@localhost tests]$ sed -i ‘s/\r//’ test.sh
[vagrant@localhost tests]$ ./test.sh
$0 (スクリプト名): ./test.sh
$1 (1番目の引数): 
$2 (2番目の引数): 
$# (引数の数): 0
“$*”: “”
“$@”: “”
0