For deploying static websites with the serverless framework do the following:
- Set up your AWS credentials on your VM
- Verify your E-Mail in AWS SES. This will be the sender!
- If not installed, then install serverless framework:
- Create the service in a new folder:
- Go in the new directory.
- Install the S3 sync plugin:
- Install the Script Plugin
- Change the service name in serverless.yml if you want.
- Overwrite your static files and folders into the static directory.
- Deploy your Stack and put you Email-adress here. This will be used as Sender in SES:
npm install -g serverless
serverless create -u https://github.com/albertschwarzkopf/serverless-static-website-with-contact-form -n serverless-static-website-with-contact-form
serverless plugin install -n serverless-s3-sync
npm install --save serverless-plugin-scripts
serverless deploy --email youremail@example.de -v --region eu-west-1
Hints:
- Take a short name without uppercase characters for service, because it ist used by default for Bucket-Name and IAM-Role.
- If you want to save the sent messages in DynamoDB when you can activate this feautre in serverless.yml