Skip to content

Instantly share code, notes, and snippets.

@MitchyBAwesome
MitchyBAwesome / ecr_instructions.md
Last active September 11, 2020 04:36
Simple example of creating a repo, setting a policy, pushing an image and trying to delete it ...

Create a directory

mkdir policy-test
cd policy-test

Create a repository

aws ecr create-repository --repository-name {REPO}
@MitchyBAwesome
MitchyBAwesome / gist:ce79840929008d4588ea898c109a8be0
Created October 29, 2019 00:14
policy_that_allows_list_but_also_download
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListAllMyBuckets",
"s3:ListBucket",
@MitchyBAwesome
MitchyBAwesome / gist:9217fc4a6de2c457758a9953d9602861
Created October 29, 2019 00:08
policy_for_listing_buckets_and_objects
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "VisualEditor0",
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets",
"s3:ListBucket",
"s3:HeadBucket"
var AWS = require('aws-sdk');
const TASK_ID = 'arc-jupyter-task:9'
const CLUSTER_NAME = 'arc-cluster';
const SUBNET_ID = 'subnet-0e33c61112aa5ed1a';
const NAME = 'arc-jupyter'
exports.handler = function (event, context, callback) {
// Each time this lambda function is triggered from an event (probably S3),
@MitchyBAwesome
MitchyBAwesome / requirements.txt
Created July 9, 2018 04:25
Simple Requirements.txt for Python App
Flask
@MitchyBAwesome
MitchyBAwesome / Dockerfile
Created July 9, 2018 04:23
Dockerfile for Simple Python Web Server
FROM python:2.7.15-alpine3.7
COPY . /app
WORKDIR /app
RUN pip install -r requirements.txt
ENTRYPOINT ["python"]
CMD ["app.py"]
@MitchyBAwesome
MitchyBAwesome / app.py
Created July 9, 2018 04:22
Simple Python Web Server
from flask import Flask
app = Flask(__name__)
@app.route('/')
def hello_world():
return 'Hello, World from Python!'
if __name__ == '__main__':
app.run(debug=True,host='0.0.0.0',port=8000)
@MitchyBAwesome
MitchyBAwesome / event_put_rule.json
Created July 9, 2018 00:50
CloudWatch Event Rule Definition
{
"Name": "CodeCommitRule",
"EventPattern": "{\"source\": [ \"aws.codecommit\" ],\"detail-type\": [ \"CodeCommit Repository State Change\" ],\"resources\": [ \"<arn_of_codecommit_repo>\" ],\"detail\": {\"event\": [\"referenceCreated\",\"referenceUpdated\"],\"referenceType\":[\"branch\"],\"referenceName\": [\"master\"]}}",
"State": "ENABLED"
}
@MitchyBAwesome
MitchyBAwesome / events_permission_policy.json
Created July 9, 2018 00:35
CloudWatch Events Permission Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"codepipeline:StartPipelineExecution"
],
"Resource": [
"*"
@MitchyBAwesome
MitchyBAwesome / events_trust_policy.json
Created July 9, 2018 00:34
CloudWatch Events Trust Policy
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"Service": "events.amazonaws.com"
},
"Action": "sts:AssumeRole"
}