Skip to content

Instantly share code, notes, and snippets.

@zachary
Last active September 16, 2025 22:59
Show Gist options
  • Select an option

  • Save zachary/ff9603eca38fda4d83fa09e7c7125b83 to your computer and use it in GitHub Desktop.

Select an option

Save zachary/ff9603eca38fda4d83fa09e7c7125b83 to your computer and use it in GitHub Desktop.
{
"AWSEBDockerrunVersion":"1",
"Image": {
"Name": "docker.io/securingdevops/invoicer",
"Update": "true"
},
"Ports": [
{
"ContainerPort": "8080"
}
],
"Logging": "/var/log/nginx"
}
aws ec2 describe-vpcs
aws ec2 create-security-group --group-name invoicer_db --description "Invoier datebase security group" --vpc-id vpc-xxxxxxxx
aws rds create-db-instance --db-name invoicer --db-instance-identifier invoicer-db --vpc-security-group-ids sg-xxxxxxxx --allocated-storage "5" --db-instance-class "db.t2.micro" --engine postgres --engine-version 9.6.2 --auto-minor-version-upgrade --publicly-accessible --master-username invoicer --master-user-password 'xxxxxxxxxxxxxxxxxx' --no-multi-az
while true; do
aws rds describe-db-instances --db-instance-identifier invoicer-db > /tmp/invoicer-db.json
dbhost=$(jq -r '.DBInstances[0].Endpoint.Address' /tmp/invoicer-db.json)
if [ "$dbhost" != "null"]; then break; fi
echo -n '.'
sleep 10
done
echo "dbhost=$dbhost"
aws elasticbeanstalk create-application --application-name invoicer --description "Securing DevOps Invoicer application"
aws elasticbeanstalk list-available-solution-stacks | jq -r '.SolutionStacks[]' | grep -P '.+Amazon Linux.+Docker.+' | head -1
aws elasticbeanstalk create-environment --application-name invoicer --environment-name invoicer-api --description "Invoicer APP" --solution-stack-name "64bit Amazon Linux 2017.03 v2.7.3 running Docker 17.03.1-ce" --option-settings file://$(pwd)/ebs-options.json --tier "Name=WebServer,Type=Standard,Version=''"
aws elasticbeanstalk describe-environments --environment-names invoicer-api | jq -r '.Environments[0].CNAME'
aws ec2 authorize-security-group-ingress --group-id sg-xxxxxxxx --cidr 0.0.0.0/0 --protocol tcp --port 5432
aws s3 mb s3://invoicer-eb
aws s3 cp app-version.json s3://invoicer-eb/
aws elasticbeanstalk create-application-version --application-name "invoicer" --version-label invoicer-api --source-bundle "S3Bucket=invoicer-eb,S3Key=app-version.json"
aws elasticbeanstalk update-environment --aplication-name invoicer --environment-id e-xxxxxxxxxx --version-label invoicer-api
curl http://invoicer-api.xxxxxxxxxx.us-east-1.elasticbeanstalk.com/__version__
curl -X POST --data '{"is_paid": false, "amount": 1664, "due_date":"2016-05-07T23:23:23Z","charges":[{"type":"blood work","amount":1664,"description":"blood work"}]}' http://invoicer-api.xxxxxxxxxx.us-east-1.elasticbeanstalk.com/invoice
curl http://invoicer-api.xxxxxxxxxx.us-east-1.elasticbeanstalk.com/invoice/1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment