Skip to content

Instantly share code, notes, and snippets.

View kapilt's full-sized avatar
🌩️
🌩 📦 🔭 📻 🚀 🛰

Kapil Thangavelu kapilt

🌩️
🌩 📦 🔭 📻 🚀 🛰
View GitHub Profile
from botocore.credentials import RefreshableCredentials
from botocore.session import get_session
from boto3 import Session
def assumed_session(role_arn, session_name, session=None):
"""STS Role assume a boto3.Session
With automatic credential renewal.
@kapilt
kapilt / gist:47f3083716bfa690ce3a
Created March 5, 2016 11:48
jp expression for tag population
# Query values over instance population for a given tag key.
jp -f "ec2-instances.json" "[].Tags[?Key == 'downtime'].Value[]"
Test

Hosted Drone with commercial subscription

Automatic Discovery.. I don't have organization access to accept the integration, ie. No organization access granted, access requested.

Using the manual add with capitalone/cloud-custodian

Status Code:500 Internal Server Error
Not Found
@kapilt
kapilt / metrics.rst
Created June 24, 2016 13:01
custodian metrics filters
Metrics Filters
---------------
Supports cloud watch metrics filters on resources.
Docs on cloud watch metrics
(custodian)60f81dc15d88:c7n ylv522$ git diff tags.py
diff --git a/c7n/tags.py b/c7n/tags.py
index a24e1d6..e83fa32 100644
--- a/c7n/tags.py
+++ b/c7n/tags.py
@@ -289,11 +289,15 @@ class Tag(Action, ResourceTag):
batch_size = self.data.get('batch_size', self.batch_size)
+ id_key = self.manager.get_model().id
@kapilt
kapilt / docker-volume-plugins.md
Last active September 11, 2016 16:27
Docker Volumes Plugins

Docker Volumes

Examining opensource docker volumes for aws ebs support.

Key requirements in this case are simplicity, support for aws ebs volumes, with kms, snapshots, and use of instance roles for credentails.

Aka secure, encrypted, and with backups.

Ideally with some notion of zone awareness and distinguishing that on container move.

policies:
- resource: eni
name: all-nics
- resource: eni
description: Amazon ELB
name: elb-nics
filters:
- RequesterManaged: true
diff --git a/c7n/resources/vpc.py b/c7n/resources/vpc.py
index bfc3793..4139f42 100644
--- a/c7n/resources/vpc.py
+++ b/c7n/resources/vpc.py
@@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.
+
from botocore.exceptions import ClientError
(custodian)60f81dc15d88:custodian ylv522$ custodian run -c rule.yml -s out -v
2016-10-07 07:43:04,779: custodian.output:DEBUG Storing output with <DirectoryOutput to dir:out/sg-check>
2016-10-07 07:43:04,779: custodian.policy:INFO Provisioning policy lambda sg-check
2016-10-07 07:43:04,886: custodian.lambda:DEBUG Created custodian lambda archive size: 0.51mb
2016-10-07 07:43:05,210: custodian.lambda:INFO Publishing custodian policy lambda function custodian-sg-check
2016-10-07 07:43:09,103: custodian.lambda:DEBUG Publishing custodian lambda alias current
2016-10-07 07:43:09,823: custodian.lambda:DEBUG Adding config rule for custodian-sg-check
2016-10-07 07:43:10,253: custodian.lambda:DEBUG Added event source: <ConfigRule> to function: arn:aws:lambda:us-east-1:644160558196:function:custodian-sg-check:current
(custodian)60f81dc15d88:custodian ylv522$ cat rule.yml