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 -ex | |
# lanch | |
instance_id=`aws ec2 run-instances --image-id ami-hoge --instance-type t2.micro --subnet-id subnet-hoge --security-group-ids sg-hoge --key-name hogekey |jq -r '.Instances[].InstanceId'` | |
echo "instance_id = ${instance_id}" | |
sleep 5 | |
# add tag | |
aws ec2 create-tags --resources ${instance_id} --tags Key=Name,Value=my-host-name |
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
sudo chpasswd <<EOT | |
user1:password1 | |
user2:password2 | |
EOT |
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
aws ec2 describe-instances --filter "Name=instance-state-name,Values=running" | jq '.Reservations[].Instances[].InstanceId' | |
# filter tag name | |
aws ec2 describe-instances --filter "Name=tag-key,Values=Name" "Name=tag-value,Values=dev-hoge" | jq '.Reservations[].Instances[].InstanceId' | |
# or | |
aws ec2 describe-instances --filter "Name=tag-key,Values=Name" "Name=tag-value,Values=dev-hoge,verification-hoge" | jq '.Reservations[].Instances[].InstanceId' | |
# get name in Tags | |
aws ec2 describe-instances --filter "Name=tag-key,Values=Group" "Name=tag-value,Values=hoge-fuga" | jq '.Reservations[].Instances[].Tags[] | select(.Key == "Name") | .Value' |
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
cp /usr/share/zoneinfo/Asia/Tokyo /etc/localtime |
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
aws ec2 run-instances --image-id ami-hogefuga |jq '.Instances[].InstanceId' |
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
ls /path/to/ | sed -e "s/.\{13\}$//" |uniq |
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
aws ses get-send-quota | jq '.SentLast24Hours / .Max24HourSend * 100' |
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
# Dockerfile | |
FROM centos:6.6 | |
MAINTAINER test | |
RUN yum -y update | |
# install package | |
RUN yum -y install passwd openssh openssh-server openssh-clients sudo python |
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 | |
expect -c" | |
set timeout 20 | |
spawn bundle exec rake | |
expect password: | |
send \"${LOGIN_PASSWORD}\n\" | |
interact |
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
@Grapes([ | |
@Grab(group='commons-codec', module='commons-codec', version='1.10'), | |
@Grab(group='com.amazonaws', module='aws-java-sdk', version='1.9.13') | |
]) | |
import com.amazonaws.services.ec2.* | |
import com.amazonaws.auth.* | |
import com.amazonaws.auth.profile.* | |
import com.amazonaws.regions.* |