In general, AWS services can be accessed using
- AWS web interface,
- API libraries in a programming language, such as
boto3for Python 3, - AWS command-line interface, i.e.
awscli.
I opted for the API library since it is
| --- | |
| # Name: ansible-aws-inventory-main.yml | |
| # Description: this is the main file that calls the worker file (ansible-aws-inventory-worker.yml) to create an inventory of all the | |
| # specific aws resources. | |
| # Below are the resources that will be inventoried | |
| # - vpc | |
| # - subnet | |
| # - igw | |
| # - cgw | |
| # - vgw |
| # Just change the first THEME variable to whatever theme you want. The line will edit, reload and print you the changed line in the .zshrc file | |
| THEME="ys"; sed -i s/^ZSH_THEME=".\+"$/ZSH_THEME=\"$THEME\"/g ~/.zshrc && source ~/.zshrc && echo "Edited line in ~/zshrc :" && cat ~/.zshrc | grep -m 1 ZSH_THEME |
| [server] | |
| SERVER | |
| [server:vars] | |
| server_name=SERVER | |
| [email protected] | |
| docker_nginx_ssl=true |
| import pandas as pd | |
| import numpy as np | |
| import timeit | |
| import pyexcelerate | |
| def pyexecelerate_to_excel(workbook_or_filename, df, sheet_name='Sheet1', origin=(1,1), columns=True, index=False): | |
| """ | |
| Write DataFrame to excel file using pyexelerate library | |
| """ |
| FROM alpine:3.14 | |
| ENV AWSCLI_VERSION "1.20.7" | |
| RUN apk add --update \ | |
| python3 \ | |
| python3-dev \ | |
| py-pip \ | |
| build-base \ | |
| && pip install awscli==$AWSCLI_VERSION --upgrade --user \ |
| # Copyright (c) 2018 Bao Nguyen <[email protected]> | |
| # | |
| # Permission is hereby granted, free of charge, to any person obtaining a copy | |
| # of this software and associated documentation files (the "Software"), to deal | |
| # in the Software without restriction, including without limitation the rights | |
| # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| # copies of the Software, and to permit persons to whom the Software is | |
| # furnished to do so, subject to the following conditions: | |
| # | |
| # The above copyright notice and this permission notice shall be included in all |
| for region in `aws ec2 describe-regions | jq -r .Regions[].RegionName` | |
| do | |
| echo "Terminating region $region..." | |
| aws ec2 describe-instances --region $region | \ | |
| jq -r .Reservations[].Instances[].InstanceId | \ | |
| xargs -L 1 -I {} aws ec2 modify-instance-attribute \ | |
| --region $region \ | |
| --no-disable-api-termination \ | |
| --instance-id {} | |
| aws ec2 describe-instances --region $region | \ |
The goal of this document is submitting a job to AWS Batch and confirming the result in CloudWatch Logs.
Since I've worked on ap-northeast-1 region, The following examples includes this region name.