项目作者: defo89

项目描述 :
Python scripts for AWS using boto3 SDK
高级语言: Python
项目地址: git://github.com/defo89/aws-boto3-scripts.git
创建时间: 2018-05-29T21:17:19Z
项目社区:https://github.com/defo89/aws-boto3-scripts

开源协议:MIT License

下载


aws-boto3-scripts

Python scripts for AWS using boto3 SDK

Script Description
ec2_start.py Start all instances with a specific tag
ec2_stop.py Stop all instances with a specific tag
ec2_ip_route53.py Get EC2 public IP and change Route53 ‘A’ record
ec2_start_and_route53.py Start EC2, get public IP and change Route53 ‘A’ record

Installation

Requires Python and boto3.

  1. git clone https://github.com/dmitrijsf/aws-boto3-scripts
  2. cd aws-boto3-scripts
  3. pip install -r requirements.txt

Usage

Set desired AWS credentials

In this example I am using aws-vault to work with desired profile.

  1. aws-vault add home
  2. Enter Access Key ID: your-aws-access-key-id
  3. Enter Secret Access Key: your-aws-access-key
  4. Added credentials to profile "home" in vault
  5. # launches subshell with desired AWS environment variables
  6. aws-vault exec -- home

Launching Scripts

  1. cd scripts
  2. # modify the script according to your needs
  3. # ec2_ip_route53.py
  4. # set instance ID
  5. instance_id = 'i-0111112233' # Instance ID, e.g. 'i-0111112233'
  6. # set Hosted Zone ID
  7. zone_id = 'ZBDAAABBBCCC' # Hosted Zone ID, e.g. 'ZBDAAABBBCCC'
  8. # domain
  9. domain = 'technoff.eu' # Domain, e.g. technoff.eu
  10. ./ec2_ip_route53.py
  11. technoff.eu record was changed to: 52.51.120.202