Skip to content

Instantly share code, notes, and snippets.

EnvironmentConfigurationMetadata:
Description: Configuration created from the EB CLI using "eb config save".
DateCreated: '1502482557000'
DateModified: '1502482557000'
Platform:
PlatformArn: arn:aws:elasticbeanstalk:us-east-1::platform/Java 8 running on 64bit Amazon Linux/2.5.1
OptionSettings:
aws:elasticbeanstalk:command:
BatchSize: '30'
BatchSizeType: Percentage
import boto3
import botocore
import os
import json
def spokevgw_handler(event, context):
vpngatewayids1 = []
vpnconnections = []
vgwtag = []
newvpcconnection = []
processfilenames = []
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
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
Resources:
AWSEBLoadBalancer:
Type: AWS::ElasticLoadBalancing::LoadBalancer
Properties:
ConnectionSettings:
IdleTimeout: 300
commands:
01_replaceTimeout:
command: sed -i 's/keepalive_timeout 65;/keepalive_timeout 600;/g' /etc/nginx/nginx.conf
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
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>
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}')
{
"Statement": [
{
"Action": [
"s3:GetObject",
"s3:GetObjectVersion",
"s3:GetBucketVersioning"
],
"Resource": "*",
"Effect": "Allow"