Provision AWS Elastic Cache clusters - Redis/Memcache
ops.json
:ops.json
in the root directory of Github
repo.
ops.json
here.id
- Alphanumeric string. Must be unique amongst the instances you’ve declared above. Changing this string will
replace the original cluster with new one.prefix
- Alphanumeric string. Will be used as a prefix in the name of your cluster. Changing this string will
replace the original cluster with new cluster.engine
- Provide either redis
or memcache
. Default: “. If you leave this out, we will skip creating the
cluster.version
- Pick a version for your redis or memcache database. Ensure Elastic Cache supports it, by referring to
AWS docs.instance_type
- Specify any class of instance in the following groups - “cache.*”. Refer to
AWS docs for available
sizes. If you leave this out, we will skip creating the cluster.num_nodes
- The initial number of cache nodes that the cache cluster will have. For Redis, this value must be 1.
For Memcached, this value must be between 1 and 40. If this number is reduced on subsequent runs, the highest
numbered nodes will be removed.exports
- Set of key value pairs. Keys are the ENVIRONMENT VARS we will pass to your code / containers. Values are
the properties of the ElastiCache cluster provisioned. See below for available properties.id
or prefix
string will delete & replace the original ElastiCache cluster with new one.exports
:
$name
- Name of the ElastiCache cluster$arn
- Amazon resource name of the ElastiCache cluster$endpoint
- The connection endpoint in address:port
format.$address
- Specifies the DNS address of the ElastiCache master node.$port
- Specifies the port you will use to access the cluster node.ops.json
at the root of the git repository, it will be processed if a corresponding service in
any of your active environment points at the same repository as source and when a deployment is triggered.
ops.json
is parsed for processing.
Resources declared in the dependencies
object will be provisioned before your code starts to run.id
are provisioned only once for the life of the service. And updated when there is a change in
one of the properties above.exports
object will be passed as enviroment variables to your service.10.0.0.0/16
(Your environment’s VPC CIDR IP range)6379
(for Redis) or 11211
(for Memcache)TCP
REDIS_*
environment variables to connect and
access the database.
Repeat the above process for each Elasticache instance you want to create for each environment - test, staging,
production, etc.,
That’s it!
REDIS_*
environment variables to connect and
access the database.
That’s it. 🎉