Skip to content

Instantly share code, notes, and snippets.

{
"Statement": [
{
"Action": [
"s3:GetObject",
"s3:GetObjectVersion",
"s3:GetBucketVersioning"
],
"Resource": "*",
"Effect": "Allow"
{
"Statement": [
{
"Action": [
"s3:GetObject",
"s3:GetObjectVersion",
"s3:GetBucketVersioning"
],
"Resource": "*",
"Effect": "Allow"
files:
"/home/ec2-user/sourceenvname.sh":
mode: "000755"
owner: root
group: root
content: |
#!/bin/bash
export AWS_DEFAULT_REGION=$(curl -s http://169.254.169.254/latest/meta-data/placement/availability-zone | sed -e 's/[a-z]$//')
instance_id=$(curl -s http://169.254.169.254/latest/meta-data/instance-id)
ebenvname=$(aws --output text ec2 describe-tags --filters "Name=resource-id,Values=${instance_id}" "Name=key,Values=elasticbeanstalk:environment-name" | awk '{print $5}')
files:
"/etc/httpd/conf.d/proxy-pass.conf":
mode: 000644
owner: root
group: root
content: |
<Location /socket>
ProxyPass ws://127.0.0.1:8081/
ProxyPassReverse ws://127.0.0.1:8081/
</Location>
commands:
01_replaceTimeout:
command: sed -i 's/keepalive_timeout 65;/keepalive_timeout 600;/g' /etc/nginx/nginx.conf
02_replaceTimeout:
command: sed -i 's/keepalive_timeout 65;/keepalive_timeout 600;/g' /etc/nginx/nginx.conf.default
commands:
01_replaceTimeout:
command: sed -i 's/keepalive_timeout 65;/keepalive_timeout 600;/g' /etc/nginx/nginx.conf
Resources:
AWSEBLoadBalancer:
Type: AWS::ElasticLoadBalancing::LoadBalancer
Properties:
ConnectionSettings:
IdleTimeout: 300
found=`fgrep -c 'NEWRELIC_INFRA="1"' /opt/elasticbeanstalk/support/envvars`
echo $found
if [ $found -eq 1 ]; then
echo 'NEWRELIC_INFRA is set'
else
echo "uninstalling newrelic-infra if already installed..."
fi
found=`fgrep -c 'NEWRELIC_INFRA="1"' /opt/elasticbeanstalk/support/envvars`
echo $found
if [ $found -eq 1 ]; then
echo "uninstalling newrelic-infra if already installed..."
else
echo 'NEWRELIC_INFRA is set'
fi
import boto3
import botocore
import os
import json
def spokevgw_handler(event, context):
vpngatewayids1 = []
vpnconnections = []
vgwtag = []
newvpcconnection = []
processfilenames = []