This file contains 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
--- | |
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 |
This file contains 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
--- | |
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' |
This file contains 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 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) | |
This file contains 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
{ | |
"homepage": "https://<your-github-username>.github.io", | |
"scripts": { | |
"deploy": "gh-pages -b master -d build" | |
} | |
} |
This file contains 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
{ | |
"homepage": "https://<your-github-username>.github.io", | |
"scripts": { | |
"deploy": "gh-pages -b master -d build" | |
} | |
} |
This file contains 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
{ | |
"homepage": "https://<your-github-username>.github.io/<project-name>", | |
"scripts": { | |
"deploy": "gh-pages -d build" | |
} | |
} |
This file contains 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
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); |
This file contains 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 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') |
This file contains 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
{ | |
"AttributeDefinitions": [ | |
{ | |
"AttributeName": "name", | |
"AttributeType": "S" | |
}, | |
{ | |
"AttributeName": "owner", | |
"AttributeType": "S" | |
} |