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
#!/usr/bin/env python3 | |
import json | |
import boto3 | |
import datetime | |
sns = boto3.client('sns') | |
response = sns.publish( | |
TopicArn="arn:aws:sns:us-east-1:555566667777:simple-topic", |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>CS4740 - CloudFront+SNS+Lambda+SNS+Dynamo Application</title> | |
<script src="https://sdk.amazonaws.com/js/aws-sdk-2.780.0.min.js"></script> | |
<link href="https://getbootstrap.com/docs/4.5/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-TX8t27EcRE3e/ihU7zmQxVncDAy5uIKz4rEkgIXeMed4M0jlfIDPvg6uqKI2xXr2" crossorigin="anonymous"> | |
</head> | |
<body> | |
<script type="text/javascript"> |
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 boto3 | |
ec2 = boto3.client('ec2') | |
response = ec2.describe_instances() | |
for r in response['Reservations']: | |
for i in r['Instances']: | |
print(i['InstanceId']) |
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
#!/bin/bash | |
curl -O https://gist.githubusercontent.com/nmagee/5636d0355d48998f91502dd811a7401c/raw/6833433672715308fff57f86792d1246ba5fe677/apache2-bootstrap.sh | |
/bin/bash apache2-bootstrap.sh |
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
#!/bin/bash | |
yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm | |
yum update -y | |
yum install -y httpd | |
systemctl start httpd | |
systemctl enable httpd |
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
#!/usr/local/bin/python3 | |
# To use this snippet: | |
# Create a bucket and upload a private file into it beforehand. | |
# To make the private file shareable for a fixed number of seconds | |
# you can "presign" the URL, which creates an expiring hashed URL. | |
# You can then distribute that URL to other systems or coleagues. | |
import boto3 |
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
#!/bin/bash | |
/usr/bin/yum update -y | |
/bin/amazon-linux-extras install -y epel | |
/usr/bin/yum install -y git python3 python3-dev python3-pip nfs-utils | |
/bin/pip3 install boto3 pandas requests |
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
# Written for AWS Lambda, for the Python 3.6 runtime. | |
import json | |
import boto3 | |
import datetime | |
## Be sure to set account number on line 57. | |
## Set DRY RUN value - for testing or running. | |
dryrun = False |
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
#!/usr/local/bin/python | |
import boto3 | |
import json | |
# The calls to AWS STS AssumeRole must be signed with the access key ID | |
# and secret access key of an existing IAM user or by using existing temporary | |
# credentials such as those from antoher role. | |
# Python SDK documentation: | |
# http://boto3.readthedocs.io/en/latest/reference/services/sts.html#client |
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 boto3 | |
from datetime import datetime | |
# Use as a starter/stub -- can and should be modified for production | |
FORMAT = '%Y%m%d-%H:%M:%S' | |
now = datetime.now().strftime(FORMAT) | |
def lambda_handler(event, context): | |
invoking_event = json.loads(event['invokingEvent']) |