https://serverless-stack.com/ logo
#sst
Title
# sst
r

Rupali Lande

06/25/2021, 9:44 AM
Hello , can anyone help me with example , how to use DAX in serverless application ?
f

Frank

06/25/2021, 5:38 PM
Hey @Rupali Lande, I don’t have a code snippet to share at the moment, but you’d need to create a VPC and a DAX cluster in CDK.
This is an example of creating a DAX cluster using raw CloudFormation https://github.com/aws-samples/amazon-dax-lambda-nodejs-sample/blob/master/template.yaml#L49-L139
These are the AWS resources you need to create:
Copy code
AWS::DAX::Cluster
AWS::DAX::SubnetGroup
AWS::IAM::Role
AWS::EC2::SecurityGroup
AWS::EC2::SecurityGroupIngress
AWS::EC2::VPC
AWS::EC2::Subnet
And you use: •
aws-dax.CfnCluster
to create the
AWS::DAX::Cluster
(doc) •
aws-dax.CfnSubnetGroup
to create the
AWS::DAX::SubnetGroup
(doc) •
aws-iam.Role
to create the
AWS::IAM::Role
(doc) •
aws-ec2.Vpc
to create the
AWS::EC2::*
(doc)
Give it a try and let me know if it works for you!
^ note that you’d need to deploy your Lambda functions inside the VPC to talk to DAX.