Skip to content

Instantly share code, notes, and snippets.

files:
"/opt/elasticbeanstalk/hooks/appdeploy/post/complete_auto_scaling_lifecycle":
mode: "000755"
owner: "root"
group: "root"
content: |
#!/bin/bash
INSTANCE_ID=`curl http://169.254.169.254/latest/meta-data/instance-id 2>/dev/null`
REGION=`curl -s http://169.254.169.254/latest/dynamic/instance-identity/document 2>/dev/null | jq -r .region`
# Find the Auto Scaling Group name from the Elastic Beanstalk environment
Resources:
lifecyclehook:
Type: AWS::AutoScaling::LifecycleHook
Properties:
AutoScalingGroupName: { "Ref" : "AWSEBAutoScalingGroup" }
LifecycleTransition: autoscaling:EC2_INSTANCE_LAUNCHING
LifecycleHookName: { "Ref" : "AWSEBAutoScalingGroup" }
@hirenalken
hirenalken / GenerateAwsS3Signature.py
Last active September 15, 2018 19:29
Generate pre-signed s3 bucket post url
import boto3
from rest_framework import status
from rest_framework.response import Response
from rest_framework.views import APIView
class GenerateAwsSignature(APIView):
"""Generate an AWS signature for presigned POST requests.
This signed data allows file uploads directly from the browser to S3.
@hirenalken
hirenalken / app.component.ts
Last active June 30, 2020 08:01
Fine uploader demo
import { Component, AfterViewInit, OnInit } from '@angular/core';
import { s3 } from 'fine-uploader/lib/core/s3';
@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.css']
})
export class AppComponent implements AfterViewInit{