bene@theodo.co.uk
Ben Ellerby
@EllerbyBen
Ben Ellerby
@EllerbyBen
serverless-transformation
@EllerbyBen
@EllerbyBen
💰 Cost reduction
👷♂️ #NoOps
💻 Developers focus on delivering business value
📈 More scalable
🌳 Greener
@EllerbyBen
Lambda
S3
Dynamo
API Gateway
Compute
Storage
Data
API Proxy
Cognito
Auth
SQS
Queue
EventBridge
Event Bus
@EllerbyBen
@EllerbyBen
@EllerbyBen
@EllerbyBen
@EllerbyBen
Always remove any file written to the /tmp directory unless you are explicitly doing it to optimize performance and have considered all potential security risks.
@EllerbyBen
const removeFolderContentsRecursively = (directory) => {
fs.readdir(directory, (err, files) => {
if (err) throw err;
for (const file of files) {
console.log(`--- Deleting ${file} ---`);
const curPath = `${directory}/${file}`;
if (fs.lstatSync(curPath).isDirectory()) {
removeFolderContentsRecursively(curPath);
} else { // delete file
try {
fs.unlinkSync(file);
} catch (error) {
}
}
}
});
}
// Clean up if on Lambda (not local!)
if (context.awsRequestId && !process.env.IS_LOCAL) {
removeFolderContentsRecursively('/tmp');
}
@EllerbyBen
@EllerbyBen
@EllerbyBen
@EllerbyBen
@EllerbyBen
@EllerbyBen
Keep your Lambdas fine-grained with a separation of concerns, using specific roles with specific policies for each.
@EllerbyBen
@EllerbyBen
@EllerbyBen
@EllerbyBen
@EllerbyBen
@EllerbyBen
Ensure all IAM policies allow the least privileges needed to perform their task. Train your team on this principle and ensure basic checks are enforced on CI.
@EllerbyBen
@EllerbyBen
@EllerbyBen
@EllerbyBen
@EllerbyBen
Avoid exposing Lambda functions to the Internet and if exposed only allow invocation through API Gateway with WAF.
@EllerbyBen
@EllerbyBen
@EllerbyBen
@EllerbyBen
@EllerbyBen
Basic logging is a given. Add onto this, X-Ray Logging and specialised third-party Serverless logging providers (and Cloudwatch ServiceLens).
Build to make your logs recoverable.
@EllerbyBen
@EllerbyBen
@EllerbyBen
Keep applying basic security principles and use the OWASP Top Ten as your reference.
Also, use automated tools like snyk and Protego
@EllerbyBen
@EllerbyBen
@EllerbyBen
Separate your dev, test and production environments to mitigate human error and attacks
MFA is not optional for your teams!
Serverless does take away some (not all) security concerns like patching
There new attack vectors and mitigating them is key
Developer speed and autonomy may threaten your security. Ops need to coach and automate
@EllerbyBen
serverless-transformation
@EllerbyBen
sls-dev-tools
@EllerbyBen