Skip to content

Instantly share code, notes, and snippets.

View camin-mccluskey's full-sized avatar
👋

Camin McCluskey camin-mccluskey

👋
View GitHub Profile
@camin-mccluskey
camin-mccluskey / NumberCrunchingServiceRole.yaml
Last active July 24, 2022 14:10
NumberCrunchingServiceRole
---
AWSTemplateFormatVersion: 2010-09-09
Description: Role for Number Crunching Service Container Instance Role with permission to assume SecretMarsDataReadOnlyRole
Outputs:
RoleARN:
Description: ARN of the container instance role
Value:
Fn::GetAtt:
- NumberCrunchingServiceRole
@camin-mccluskey
camin-mccluskey / SecretMarsDataReadOnlyRole.yaml
Last active July 24, 2022 14:10
SecretMarsDataReadOnlyRole Definition
---
AWSTemplateFormatVersion: "2010-09-09"
Description: "Access permission role for Mars data table"
Outputs:
SecretMarsDataReadOnlyRole:
Description: 'IAM Role granting read only permission to secret-mars-data'
Value: !Ref SecretMarsDataReadOnlyRole
Export:
Name: 'SecretMarsDataReadOnlyRole'
@camin-mccluskey
camin-mccluskey / nasa_client.py
Last active November 20, 2020 18:08
Initialise NASA Client
import boto3
from boto3.session import Session
MARS_DATA_ROLE_ARN = "arn:aws:iam::9999999999:role/SecretMarsDataReadOnlyRole" # role ARN shared with us
DEFAULT_ROLE_SESSION_NAME = "mars-data-access-role-session"
def get_nasa_data_client():
client = boto3.client('sts')
response = client.assume_role(RoleArn=MARS_DATA_ROLE_ARN, RoleSessionName=DEFAULT_ROLE_SESSION_NAME)
@camin-mccluskey
camin-mccluskey / package.json
Created August 5, 2020 20:52
User Site package.json
{
"homepage": "https://<your-github-username>.github.io",
"scripts": {
"deploy": "gh-pages -b master -d build"
}
}
@camin-mccluskey
camin-mccluskey / package.json
Created August 5, 2020 20:50
User Site package.json
{
"homepage": "https://<your-github-username>.github.io",
"scripts": {
"deploy": "gh-pages -b master -d build"
}
}
@camin-mccluskey
camin-mccluskey / package.json
Last active August 5, 2020 20:45
Project Site package.json
{
"homepage": "https://<your-github-username>.github.io/<project-name>",
"scripts": {
"deploy": "gh-pages -d build"
}
}
@camin-mccluskey
camin-mccluskey / node_example.js
Created June 29, 2020 18:41
Using dynamodb-admin as a library
const AWS = require('aws-sdk');
const {createServer} = require('dynamodb-admin');
const dynamodb = new AWS.DynamoDB();
const dynClient = new AWS.DynamoDB.DocumentClient({service: dynamodb});
const app = createServer(dynamodb, dynClient);
const port = 8001;
const server = app.listen(port);
@camin-mccluskey
camin-mccluskey / python_boto_example.py
Last active June 29, 2020 19:39
Boto Example - Read from local dynamo
from pprint import pprint
import boto3
from botocore.exceptions import ClientError
def get_movie(title, year, dynamodb=None):
if not dynamodb:
dynamodb = boto3.resource('dynamodb', endpoint_url="http://localhost:8000")
table = dynamodb.Table('Movies')
@camin-mccluskey
camin-mccluskey / cats_table_def.json
Last active June 29, 2020 18:17
Cats Table Definition
{
"AttributeDefinitions": [
{
"AttributeName": "name",
"AttributeType": "S"
},
{
"AttributeName": "owner",
"AttributeType": "S"
}