Skip to content

Latest commit

 

History

History
56 lines (45 loc) · 2.06 KB

README.md

File metadata and controls

56 lines (45 loc) · 2.06 KB

Simple deployments

npm version Build Status

Deploy to AWS ElasticBeanstalk

Deploy packages to AWS Elastic Beanstalk easily. Used by the Instant CLI to automate Elastic Beanstalk deployments.

It can be used with the @instant.dev/encrypt to automatically encrypt .env files stored in plaintext, with the encryption keys loaded into ElasticBeanstalk at runtime as environment variables.

import { DeploymentManager } from '@instant.dev/deploy';
import EncryptionTools from '@instant.dev/encrypt';

const envName = `staging`;

// Prepare to encrypt .env file
const et = new EncryptionTools();
// Loads deployment variables from ".deployconfig.staging" INI-format file
const dm = new DeploymentManager(`.deployconfig.${envName}`);

// Encrypts `.env.staging` as `.env` in final package
// Also deletes all files matching `.env.*` from final package
const {files, env} = et.encryptEnvFileFromPackage(
  // Reads all files in this directory, stores them in files {} object
  dm.readPackageFiles('~/projects/instant.dev/test-empty'),
  `.env.${envName}`,
  `.env`,
  /^\.env\..*$/
);

// Deploys to ElasticBeanstalk
let deployResult = await dm.deployToElasticBeanstalk(files, envName, env);
/**
{
  app_url: 'my-app.elasticbeanstalk.com',
  dashboard_url: 'https://console.aws.amazon.com/...'
}
 */

Acknowledgements

Special thank you to Scott Gamble who helps run all of the front-of-house work for instant.dev 💜!

Destination Link
Home instant.dev
GitHub github.com/instant-dev
Discord discord.gg/puVYgA7ZMh
X / instant.dev x.com/instantdevs
X / Keith Horwood x.com/keithwhor
X / Scott Gamble x.com/threesided