routeアカウントで、[IAM User Access to Billing Information] の横にある [Edit] を押してIAMユーザによる請求書情報ページへのアクティベートをする。
https://docs.aws.amazon.com/ja_jp/awsaccountbilling/latest/aboutv2/grantaccess.html
KMSで暗号化時にS3からダウンロードするとエラー
AWS Signature Version 4を有効にする
構成図 自動作成
Hava
http://dev.classmethod.jp/cloud/aws/generate-aws-architecture-diagrams-automatically-with-hava/
Cloudcraft Live
http://dev.classmethod.jp/cloud/cloudcraft-live/
download failed: s3://kms-test-865011514531/test.txt to ./test_downloaded.txt An error occurred (InvalidArgument) when calling the GetObject operation: Requests specifying Server Side Encryption with AWS KMS managed keys require AWS Signature Version 4. You can enable AWS Signature Version 4 by running the command:
aws configure set s3.signature_version s3v4
aws configure set s3.signature_version s3v4
404 Not Found
Code: NoSuchKey
Message: The specified key does not exist.
Key: already.html
RequestId: 643FE9E94482BB5B
HostId: qcuzLKNL/XXRnOsH1pwrMaUIVR0BW1pudcV4jl6G7OE/ZwqGYLK95HCaf3R2DrtqvXCTr7DW+rQ=
An Error Occurred While Attempting to Retrieve a Custom Error Document
Code: NoSuchKey
Message: The specified key does not exist.
Key: error.html
$ pip install requests -t .
$ zip -r upload.zip *
$ python
Python 3.5.1 (v3.5.1:37a07cee5969, Dec 6 2015, 01:38:48) [MSC v.1900 32 bit (In
tel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> from lambda_function import lambda_handler
>>> lambda_handler(None,None)
#!/bin/bash
LOAD_BALANCER_NAME="[ロードバランサ名]"
# Get self instance id and ip address.
MY_INSTANCE=`curl -s 169.254.169.254/latest/meta-data/instance-id/`
# ロードバランサ配下の有効なインスタンスの一覧を取得
INSTANCE_LIST=`aws elb describe-instance-health \
--load-balancer-name ${LOAD_BALANCER_NAME} \
--region ap-northeast-1 \
--query 'InstanceStates[?State==\`InService\`].InstanceId' | jq -r '.[]'`
IS_ACTIVE=0
for INSTANCE in ${INSTANCE_LIST}
do
if [ ${INSTANCE} = ${MY_INSTANCE} ]; then
IS_ACTIVE=1
continue
fi
if [ ${INSTANCE} \< ${MY_INSTANCE} ]; then
exit 1
fi
done
if [ ${IS_ACTIVE} -eq 1 ]; then
exit 0
else
exit 1
fi
#!/bin/bash
check.sh
IS_RUN=$?
if [ $IS_RUN -eq 0 ]; then
[バッチの実行]
fi