$ cat terraform.tf
resource "aws_rds_cluster" "test_db_cluster" {
cluster_identifier = "test-db"
availability_zones = ["ap-northeast-1a","ap-northeast-1c"]
database_name = "foobar"
master_username = "foobar"
master_password = "hogehoge"
backup_retention_period = 35
preferred_backup_window = "07:00-09:00"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
apt-get update -y | |
apt-get install -y libpcre2-dev imagemagick libimlib2-dev libgd-dev libmagickwand-dev libxml2-dev libxslt-dev libgeoip-dev libperl-dev curl git openssl libssl-dev | |
ln -s /usr/lib/x86_64-linux-gnu/ImageMagick-6.8.9/bin-Q16/Wand-config /usr/bin/ | |
mkdir -p /usr/local/src/nginx/modules | |
cd /usr/local/src/nginx/modules | |
git clone https://github.com/cubicdaiya/ngx_dynamic_upstream | |
git clone https://github.com/cubicdaiya/ngx_small_light | |
cd ngx_small_light | |
./setup --with-imlib2 --with-gd |
$ aws rds describe-db-snapshots --snapshot-type automated | jq '.DBSnapshots | sort_by(.SnapshotCreateTime) | reverse | .[0]'
{
"Engine": "mysql",
"SnapshotCreateTime": "2016-09-25T18:46:55.366Z",
"AvailabilityZone": "ap-northeast-1a",
"PercentProgress": 100,
"MasterUsername": "root",
IAM Role でも aws configure
しないと動かないので注意
$ cat /etc/cron.d/stop-instance
30 18 * * * root aws ec2 stop-instances --instance-ids $(curl -s http://169.254.169.254/latest/meta-data/instance-id)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo 'ZONE="Asia/Tokyo"' > /etc/sysconfig/clock | |
if grep "amazon linux" -iqs /etc/system-release; then | |
# for Amazon Linux | |
rm -f /etc/localtime | |
ln -s /usr/share/zoneinfo/Japan /etc/localtime | |
else | |
# for CentOS | |
/usr/sbin/tzdata-update |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Version": "2012-10-17", | |
"Statement": [ | |
{ | |
"Effect": "Allow", | |
"Action": "elasticloadbalancing:DescribeTags", | |
"Resource": "*" | |
}, | |
{ | |
"Effect": "Allow", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
META_DATA="http://169.254.169.254/latest/meta-data" | |
fetch_uri() { | |
for md in $(curl -s "${META_DATA}/${1}"); do | |
if echo "${md}" | grep -qs -E "/$"; then | |
fetch_uri "${1}${md}" | |
else | |
echo "${META_DATA}/${1}${md}" |