This file contains hidden or 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 { aws_eks as eks } from "aws-cdk-lib"; | |
import { aws_iam as iam } from "aws-cdk-lib"; | |
import { aws_ec2 as ec2 } from "aws-cdk-lib"; | |
import { aws_ssm as ssm } from "aws-cdk-lib"; | |
import { Construct } from "constructs"; | |
import { Duration, CfnJson } from "aws-cdk-lib"; | |
interface KarpenterProps { | |
/** | |
* The FargateCluster on which karpenter needs to be added |
This file contains hidden or 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
// tslint:disable-next-line:max-line-length | |
const privateSubnetID1 = ec2.Subnet.fromSubnetId(this, 'DataSourcePrivateSubnetSSMParameter1', ssm.StringParameter.fromStringParameterAttributes(this, 'DataSourceSSMSubnet1', { | |
parameterName: '/corp/landing-zone/vpc/subnets/private-1-id' | |
}).stringValue); | |
// SubnetSelection | |
vpcSubnets: { subnets: [privateSubnetID1, privateSubnetID2, privateSubnetID3] } |
This file contains hidden or 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
{ | |
"openapi": "3.0.1", | |
"info": { | |
"title": "fwhoof", | |
"version": "2021-10-17T18:09:20Z" | |
}, | |
"servers": [ | |
{ | |
"url": "https://whoof.corp" | |
} |
This file contains hidden or 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
# Lets take a simple event | |
# and event.json is the jsonschema of it | |
# { | |
# "administration": "YOURBACKOFFICECODE", | |
# "personNumber": 1337 | |
# } | |
import json | |
from logging import getLogger, INFO |
This file contains hidden or 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
from schema.your_schema_openapiv3 import Event | |
from schema.your_schema_openapiv3 import AWSEvent | |
from schema.your_schema_openapiv3 import Marshaller | |
import json | |
def lambda_handler(event, context): | |
"""function | |
Parameters | |
---------- |
This file contains hidden or 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 json | |
import os | |
import requests | |
from requests.structures import CaseInsensitiveDict | |
headers = {"Accept": "application/json","Content-Type": "application/json" ,"Authorization": "Bearer " + os.environ['grafana_pw']} | |
# package dashboard with on the fs since usually the string is too long | |
with open("dashboard.json") as file: |
This file contains hidden or 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
from requests_aws4auth import AWS4Auth | |
import boto3 | |
import requests | |
credentials = boto3.Session().get_credentials() | |
awsauth = AWS4Auth(credentials.access_key, credentials.secret_key, 'eu-central-1', 'es', session_token=credentials.token) | |
r = requests.get(url, auth=awsauth) |
This file contains hidden or 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
# Talk to an AWS IAM protected ElasticSearch cluster | |
# Since its pretty hard to resort for this kind of stuff to curl (or extentions on it) we use Python | |
# Also, since its bothersome to check for the correct credentials place (disk, env, metadata endpoint, containerdata endpoint) | |
# its better to just peel out SigV4Auth from botocore.auth | |
# pip3 install boto3 requests | |
import boto3 | |
from botocore.auth import SigV4Auth | |
from botocore.awsrequest import AWSRequest | |
import requests, sys |
This file contains hidden or 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
from aws_cdk import ( | |
core, | |
aws_elasticloadbalancingv2 as elbv2, | |
aws_secretsmanager as sm | |
) | |
[...] | |
secret_bundle = sm.Secret.from_secret_arn( | |
self, |