This file contains 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": [ | |
"logs:CreateLogGroup", | |
"logs:CreateLogStream", | |
"logs:PutLogEvents", | |
"config:PutEvaluations", |
This file contains 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
import boto3 | |
import datetime | |
import json | |
config = boto3.client("config") | |
ec2 = boto3.client("ec2") | |
def evaluate_flowlog(vpc_id): | |
response = ec2.describe_flow_logs( | |
Filter=[ |
This file contains 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
# -*- coding: utf-8 -*- | |
option = ARGV[0] | |
def exit_test(option) | |
if option == "hoge" | |
puts "正常終了でほげ" | |
exit 0 | |
elsif option == "foo" | |
puts "異常終了でふー" |
This file contains 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
# -*- coding: utf-8 -*- | |
require 'aws-sdk' | |
access_key = 'set your access key' | |
secret_key = 'set your secret key' | |
sqs_region = 'sqs.ap-northeast-1.amazonaws.com' | |
queue_name = 'okochang_que' | |
sqs = AWS::SQS.new( | |
:access_key => access_key, | |
:secret_key => secret_key, |
This file contains 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
# -*- coding: utf-8 -*- | |
## AWS SDK for Rubyで各サービスのリージョンを指定する方法一覧 | |
AWS.config( | |
:access_key_id => 'set_your_access_key_id', | |
:secret_access_key => 'set_your_secret_key', | |
:auto_scaling_endpoint => 'autoscaling.ap-northeast-1.amazonaws.com', | |
:cloud_formation_endpoint => 'cloudformation.ap-northeast-1.amazonaws.com', | |
:cloud_front_endpoint => 'cloudfront.amazonaws.com', |
This file contains 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
# -*- coding: utf-8 -*- | |
require 'net/http' | |
require 'aws-sdk' | |
instance_id = Net::HTTP.get('169.254.169.254', '/latest/meta-data/instance-id') | |
ec2_region = 'ec2.' + Net::HTTP.get('169.254.169.254', '/latest/meta-data/placement/availability-zone').chop + '.amazonaws.com' | |
image_name = instance_id + '-' + Time.now.strftime("%Y%m%d%H%M") | |
comment = "automatically generated image" | |
@ec2 = AWS::EC2.new( |
This file contains 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
# -*- coding: utf-8 -*- | |
require 'aws-sdk' | |
ACCESS_KEY = 'set your access key' | |
SECRET_KEY = 'set your secret key' | |
support = AWS::Support.new( | |
:access_key_id => ACCESS_KEY, | |
:secret_access_key => SECRET_KEY, | |
).client |
This file contains 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
# -*- coding: utf-8 -*- | |
## AWSのIAM用APIを使ってみたログであり、スクリプトではありません。 | |
require 'aws-sdk' | |
ACCESS_KEY = 'set your access key' | |
SECRET_KEY = 'set your secret key' | |
alias_name = 'okochang' | |
user_name = 'yanase' | |
user_policy_name = 'admin_user_policy' | |
user_policy = '{"Statement":[{"Effect":"Deny","Action":["support:*"],"Resource":"*"},{"Effect":"Allow","Action":"*","Resource":"*"}]}' | |
group_name = 'administrator' |
This file contains 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
# -*- coding: utf-8 -*- | |
## VPCを作成して削除するまでの流れを記載したもので、スクリプトではないので注意して下さい | |
require 'aws-sdk' | |
ACCESS_KEY = 'set your access key' | |
SECRET_KEY = 'set your secret key' | |
EC2_REGION = 'ec2.ap-southeast-1.amazonaws.com' | |
ec2 = AWS::EC2.new( | |
:access_key_id => ACCESS_KEY, | |
:secret_access_key => SECRET_KEY, |
This file contains 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
# -*- coding: utf-8 -*- | |
require 'aws-sdk' | |
## 設定 | |
access_key = 'set your access key' | |
secret_key = 'set your secret key' | |
rds_region = 'rds.ap-northeast-1.amazonaws.com' | |
rds_db_identifier = 'set your db identifier' | |
script_identifier = 'rotate-script' | |
copied_snapshot_name = rds_db_identifier + '-' + script_identifier + Time.now.strftime("%Y-%m-%d") |
NewerOlder