Skip to content

Instantly share code, notes, and snippets.

---
collections:
- amazon.aws
- community.aws
- azure.azcollection
-r https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt
boto
boto3
awscli
cdpcli>=0.9.15
colorama<=0.3.3,>=0.2.5
docutils==0.14
jsonpointer
nipyapi
jsonmerge
@Chaffelson
Chaffelson / rmvpc.py
Created February 21, 2020 09:40 — forked from vernhart/rmvpc.py
Deleting an AWS VPC with python's boto3
#!/usr/bin/env python
"""I was trying to programatically remove a Virtual Private Cloud (VPC) in
AWS and the error message was not helpful:
botocore.exceptions.ClientError: An error occurred (DependencyViolation)
when calling the DeleteVpc operation: The vpc 'vpc-c12029b9' has
dependencies and cannot be deleted.
Searching for a quick solution was not fruitful but I was able to glean some
knowledge from Neil Swinton's gist:
Link to this https://tinyurl.com/y3rk7yzt
Cloudbreak URL: https://3.213.189.153/clusters user: admin@example.com password:supersecret1
DPS: https://18.215.106.73/infra/clusters user: admin password:supersecret1
Add to /etc/hosts file "3.216.131.122 ip-10-0-1-245.ec2.internal
35.174.248.28 ip-10-0-1-43.ec2.internal
3.216.68.195 ip-10-0-1-170.ec2.internal
34.224.171.214 ip-10-0-1-24.ec2.internal
18.209.145.213 ip-10-0-1-59.ec2.internal"
RENAME THIS FILE TO .profile.yml before putting your secrets in it, so you don't commit them to the repo!
Then delete these two lines - they are here to cause an error if you don't read instructions
infra:
EC2: # EC2 matches the Provider Service name that libcloud uses, do not change for AWS users
key: ... # Key for your AWS Credential
secret: ... # Secret for your AWS Credential
region: eu-central-1 # Region to deploy everything in
infraarn: arn:aws:iam::<account>:instance-profile/<InfRoleName> # ARN for Cloudbreak Credential, see bottom note #1
credarn: arn:aws:iam::<account>:instance-profile/<CredRoleName> # ARN for Cloudbreak Credential, see bottom note #1
# Schema Registry Swagger docco: http://localhost:7788/api/swagger#/
# #!
# Setup
sudo yum install -y jq xml2
# Download schemas
curl -ssLO https://gist.githubusercontent.com/Chaffelson/2b7801007f65a10b13cf5690b6921eb6/raw/06e986f22f1c384a2d9c3c2d6b45f9c1b1f4c052/rawtruckevents.avsc
curl -ssLO https://gist.githubusercontent.com/Chaffelson/0e8f90ab153ea19295b6992b7512307e/raw/8cae7efd1115c2e1d6862e40959d9c924ff7615e/geotruckevents.avsc
curl -ssLO https://gist.githubusercontent.com/Chaffelson/5b757ee6db17f5a0947facf530a4d429/raw/94aa12eb6f5180d6f76e69d3e7afb1c2d91c8c72/truckspeedevents.avsc
# Create Schemas in Registry
curl -H "Content-Type: application/json" -X POST -d '{ "type": "avro", "schemaGroup": "truck-sensors-kafka", "name": "raw-truck_events_avro", "description": "Raw Geo events from trucks in Kafka Topic", "compatibility": "BACKWARD", "evolve": true}' http://localhost:7788/api/v1/schemaregistry/schemas
<?xml version="1.0" ?>
<template encoding-version="1.1">
<description></description>
<groupId>7c84501d-d10c-407c-b9f3-1d80e38fe36a</groupId>
<name>NiFiSamTemplate</name>
<snippet>
<controllerServices>
<id>e49634e5-fbf3-35b0-0000-000000000000</id>
<parentGroupId>46f95fe5-3024-31d8-0000-000000000000</parentGroupId>
<bundle>
{
"type" : "record",
"namespace" : "hortonworks.hdp.refapp.trucking",
"name" : "truckgeoeventkafka",
"fields" : [
{ "name" : "eventTime" , "type" : "string" },
{ "name" : "eventSource" , "type" : "string" },
{ "name" : "truckId" , "type" : "int" },
{ "name" : "driverId" , "type" : "int"},
{ "name" : "driverName" , "type" : "string"},
{
"type" : "record",
"namespace" : "hortonworks.hdp.refapp.trucking",
"name" : "truckgeoevent",
"fields" : [
{ "name" : "eventTime" , "type" : "string" },
{ "name" : "eventSource" , "type" : "string" },
{ "name" : "truckId" , "type" : "int" },
{ "name" : "driverId" , "type" : "int"},
{ "name" : "driverName" , "type" : "string"},
{
"type" : "record",
"namespace" : "hortonworks.hdp.refapp.trucking",
"name" : "truckspeedevent",
"fields" : [
{ "name" : "eventTime" , "type" : "string" },
{ "name" : "eventSource" , "type" : "string" },
{ "name" : "truckId" , "type" : "int" },
{ "name" : "driverId" , "type" : "int"},
{ "name" : "driverName" , "type" : "string"},