This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// As of April 25, 2019 --> Make sure to call $ 'npm install aws-sdk' to package this function before deploying to Lambda as the RDSDataService API is currently in BETA and | |
// therefore not available in the default aws-sdk included in the Node 8 engine built into Lambda. | |
// This code uses RDSDataService API for connecting to a Data API enabled Aurora Serverless database: https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/RDSDataService.html | |
// Call this function with: { "sqlStatement": "SELECT * FROM <YOUR-TABLE-NAME"} | |
// Deploy this Lambda function via CloudFormation here: https://github.com/mobilequickie/rds-aurora-mysql-serverless | |
const AWS = require('aws-sdk') | |
const RDS = new AWS.RDSDataService() | |
exports.handler = async (event, context) => { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
const crypto = require('crypto'); | |
const ENCRYPTION_KEY = process.env.ENCRYPTION_KEY; // Must be 256 bits (32 characters) | |
const IV_LENGTH = 16; // For AES, this is always 16 | |
function encrypt(text) { | |
let iv = crypto.randomBytes(IV_LENGTH); | |
let cipher = crypto.createCipheriv('aes-256-cbc', Buffer.from(ENCRYPTION_KEY), iv); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Sidekiq interaction and startup script | |
commands: | |
create_post_dir: | |
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post" | |
ignoreErrors: true | |
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh": | |
mode: "000755" | |
owner: root | |
group: root |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# The following script will deploy a Laravel 5 applicaion on AWS Elastic Beanstalk. | |
# Add to .ebextensions at the root of your application and name your commands file (e.g., commands.config) | |
# -------------------------------- Commands ------------------------------------ | |
# Use "commands" key to execute commands on the EC2 instance. The commands are | |
# processed in alphabetical order by name, and they run before the application | |
# and web server are set up and the application version file is extracted. | |
# ------------------------------------------------------------------------------ | |
commands: | |
01updateComposer: |