Skip to content

Instantly share code, notes, and snippets.

@cloudfiles-me
cloudfiles-me / outposts.json
Created April 20, 2021 17:54 — forked from ahl/outposts.json
AWS Outposts configurations from an unpublished API
{
"NextToken": null,
"PodCatalogItems": [
{
"AvailableEC2Capacities": [
{
"Family": "m5",
"MaxSize": "24xlarge",
"Quantity": "6"
},
@cloudfiles-me
cloudfiles-me / systemd-prblm.service
Created April 30, 2020 17:37 — forked from nickjacob/systemd-prblm.service
execute arbitrary bash code/variable substitution in systemd units
[Unit]
Description=Demonstrate Bash
[Service]
ExecStartPre=/usr/bin/bash -c "/usr/bin/systemctl set-environment MYVAR=$(( 2 + 2 ))"
ExecStart=/usr/bin/echo "2 + 2 = ${MYVAR}"
@cloudfiles-me
cloudfiles-me / eks.py
Last active June 9, 2020 22:02 — forked from iferca/eks.py
eks_cluster_cdk.py
from aws_cdk import (
core,
aws_ec2 as ec2,
aws_eks as eks,
aws_iam as iam
)
class StackK8SStack(core.Stack):
@cloudfiles-me
cloudfiles-me / kinesis-twitter.py
Created October 15, 2019 20:59 — forked from DaisukeMiyamoto/kinesis-twitter.py
put twitter search results to Amazon Kinesis on AWS
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import time
import json
import twitter
import boto3
@cloudfiles-me
cloudfiles-me / lambda_assume_role.py
Created October 3, 2019 18:03 — forked from ozgurakan/lambda_assume_role.py
Assume Role within A Lambda function (Python)
import boto3
# you can assign role in the function like below
# ROLE_ARN = 'arn:aws:iam::01234567890:role/my_role'
#
# or you can pass role as an evironment varibale
# ROLE_ARN = os.environ['role_arn']
ROLE_ARN = = os.environ['role_arn']
@cloudfiles-me
cloudfiles-me / vscode_live_server_https_config.txt
Created September 10, 2019 22:03
Configuration used to set https support on vscode live server extention
"liveServer.settings.https": {
"enable": true, //set it true to enable the feature.
"cert": "/Users/jorgehrn/Documents/GitHub/get-qs-dashboard-url/ssl/server.crt", //full path of the certificate
"key": "/Users/jorgehrn/Documents/GitHub/get-qs-dashboard-url/ssl/server.key", //full path of the private key
"passphrase": ""
}
@cloudfiles-me
cloudfiles-me / queues.py
Created August 14, 2019 13:48 — forked from juandesant/queues.py
Shows how to use SQS to generate and receive messages in AWS
#in order to run the code above, install the python packages above:
#pip install ec2-metadata
#pip install boto3
#!/usr/bin/python
import time
import boto3
from ec2_metadata import ec2_metadata
#constants
@cloudfiles-me
cloudfiles-me / cloud9_codecommit.txt
Created August 13, 2019 19:21
AWS Cloud 9 with Codecommit integration
git config --global user.name "Jorge Hernandez"
git config --global user.email my_email
git config --global credential.helper '!aws codecommit credential-helper $@'
git config --global credential.UseHttpPath true
@cloudfiles-me
cloudfiles-me / cf-s3-basic-auth.js
Created May 31, 2019 19:25
Node.js 8.10 Snippet for basic auth at Lambda@Edge for CloudFront + S3 Static website
/**
* BASIC Authentication
*
* Lambda@Edge snippet for basic auth with CloudFront & Amazon S3 (static website)
* This code use viewer request integration btw CloudFront 7 Lambda@Edge
*
*/
'use strict';
import os
import sys
from zipfile import ZipFile
import boto3
S3 = boto3.resource('s3')