multicloud365
  • Home
  • Cloud Architecture
    • OCI
    • GCP
    • Azure
    • AWS
    • IAC
    • Cloud Networking
    • Cloud Trends and Innovations
    • Cloud Security
    • Cloud Platforms
  • Data Management
  • DevOps and Automation
    • Tutorials and How-Tos
  • Case Studies and Industry Insights
    • AI and Machine Learning in the Cloud
No Result
View All Result
  • Home
  • Cloud Architecture
    • OCI
    • GCP
    • Azure
    • AWS
    • IAC
    • Cloud Networking
    • Cloud Trends and Innovations
    • Cloud Security
    • Cloud Platforms
  • Data Management
  • DevOps and Automation
    • Tutorials and How-Tos
  • Case Studies and Industry Insights
    • AI and Machine Learning in the Cloud
No Result
View All Result
multicloud365
No Result
View All Result

Defend Amazon Join from viruses and malware by scanning attachments

admin by admin
April 23, 2025
in AWS
0
Defend Amazon Join from viruses and malware by scanning attachments
399
SHARES
2.3k
VIEWS
Share on FacebookShare on Twitter


const { CfnParameter, CfnCondition, CfnOutput, Fn, Aws } = require('aws-cdk-lib');
const dynamodb = require('aws-cdk-lib/aws-dynamodb');
const cloudwatch = require('aws-cdk-lib/aws-cloudwatch');
const sns = require('aws-cdk-lib/aws-sns');
const lambda = require('aws-cdk-lib/aws-lambda');
const iam = require('aws-cdk-lib/aws-iam');
const logs = require('aws-cdk-lib/aws-logs');
const esbuild = require('esbuild');


operate zipFile(lambdaFile, goal) {
return esbuild.buildSync({
entryPoints: [lambdaFile],
exterior: ['@aws-sdk/*'],
goal: [target],
platform: 'node',
bundle: true,
write: false
}).outputFiles[0].textual content;
}

const bucketAVStackName = new CfnParameter(this, 'BucketAVStackName', {
description: 'CloudFormation stack identify of bucketAV (should you adopted our docs, the identify is bucketav)',
sort: 'String'
});

const desk = new dynamodb.CfnTable(this, 'Desk', {
attributeDefinitions: [{
attributeName: 'id',
attributeType: 'S'
}],
billingMode: 'PAY_PER_REQUEST',
keySchema: [{
attributeName: 'id',
keyType: 'HASH'
}],
sseSpecification: {
sseEnabled: true
},
timeToLiveSpecification: {
attributeName: 'ttl',
enabled: true
}
});

const subscriptionLambdaRole = new iam.CfnRole(this, 'SubscriptionLambdaRole', {
assumeRolePolicyDocument: {
Model: '2012-10-17',
Assertion: [{
Effect: 'Allow',
Principal: {
Service: 'lambda.amazonaws.com'
},
Action: 'sts:AssumeRole'
}]
},
insurance policies: [{
policyName: 'lambda',
policyDocument: {
Statement: [{
Effect: 'Allow',
Action: 'dynamodb:PutItem',
Resource: table.attrArn
}]
}
}]
});

const subscriptionLambdaFunction = new lambda.CfnFunction(this, 'SubscriptionLambdaFunction', {
code: {
zipFile: zipFile('connect-subscription.js', 'node18')
},
surroundings: {
variables: {
TABLE_NAME: desk.ref
}
},
handler: 'index.handler',
memorySize: 1769,
function: subscriptionLambdaRole.attrArn,
runtime: 'nodejs18.x',
timeout: 60
});

const subscriptionLambdaPermission = new lambda.CfnPermission(this, 'SubscriptionLambdaPermission', {
motion: 'lambda:InvokeFunction',
functionName: subscriptionLambdaFunction.ref,
principal: 'sns.amazonaws.com',
sourceArn: Fn.importValue(`${bucketAVStackName.valueAsString}-FindingsTopicArn`)
});

const subscriptionLambdaLogGroup = new logs.CfnLogGroup(this, 'SubscriptionLambdaLogGroup', {
logGroupName: `/aws/lambda/${subscriptionLambdaFunction.ref}`,
retentionInDays: 14
});

const subscriptionLambdaPolicy = new iam.CfnPolicy(this, 'SubscriptionLambdaPolicy', {
roles: [
subscriptionLambdaRole.ref
],
policyName: 'logs',
policyDocument: {
Assertion: [{
Effect: 'Allow',
Action: [
'logs:CreateLogStream',
'logs:PutLogEvents'
],
Useful resource: subscriptionLambdaLogGroup.attrArn
}]
}
});

const subscription = new sns.CfnSubscription(this, 'Subscription', {
endpoint: subscriptionLambdaFunction.attrArn,
filterPolicy: {
trace_id: [{prefix: `bucketav:connect:${Aws.STACK_NAME}:`}]
},
protocol: 'lambda',
topicArn: Fn.importValue(`${bucketAVStackName.valueAsString}-FindingsTopicArn`)
});
subscription.addDependency(subscriptionLambdaPermission);
subscription.addDependency(subscriptionLambdaPolicy);

const connectLambdaRole = new iam.CfnRole(this, 'ConnectLambdaRole', {
assumeRolePolicyDocument: {
Model: '2012-10-17',
Assertion: [{
Effect: 'Allow',
Principal: {
Service: 'lambda.amazonaws.com'
},
Action: 'sts:AssumeRole'
}]
},
insurance policies: [{
policyName: 'lambda',
policyDocument: {
Statement: [{
Effect: 'Allow',
Action: 'sqs:SendMessage',
Resource: Fn.importValue(`${bucketAVStackName.valueAsString}-ScanQueueArn`)
}, {
Effect: 'Allow',
Action: 'dynamodb:GetItem',
Resource: table.attrArn
}]
}
}]
});

const connectLambdaFunction = new lambda.CfnFunction(this, 'ConnectLambdaFunction', {
code: {
zipFile: zipFile('join.js', 'node18')
},
surroundings: {
variables: {
TABLE_NAME: desk.ref,
STACK_NAME: Aws.STACK_NAME,
SCAN_QUEUE_URL: Fn.importValue(`${bucketAVStackName.valueAsString}-ScanQueueUrl`)
}
},
handler: 'index.handler',
memorySize: 1769,
function: connectLambdaRole.attrArn,
runtime: 'nodejs18.x',
timeout: 60
});

const connectLambdaLogGroup = new logs.CfnLogGroup(this, 'ConnectLambdaLogGroup', {
logGroupName: `/aws/lambda/${connectLambdaFunction.ref}`,
retentionInDays: 14
});

new iam.CfnPolicy(this, 'ConnectLambdaPolicy', {
roles: [
connectLambdaRole.ref
],
policyName: 'logs',
policyDocument: {
Assertion: [{
Effect: 'Allow',
Action: [
'logs:CreateLogStream',
'logs:PutLogEvents'
],
Useful resource: connectLambdaLogGroup.attrArn
}]
}
});








Tags: AmazonAttachmentsConnectMalwareProtectscanningviruses
Previous Post

Commerce tensions immediate European companies to rethink cloud methods

Next Post

How Legit Is Utilizing Traditional Financial Instruments to Forestall Utility Vulnerabilities

Next Post
How Legit Is Utilizing Traditional Financial Instruments to Forestall Utility Vulnerabilities

How Legit Is Utilizing Traditional Financial Instruments to Forestall Utility Vulnerabilities

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Trending

UKOUG Uncover 2024 | The ORACLE-BASE Weblog

UKOUG Convention 2024 | The ORACLE-BASE Weblog

April 4, 2025
Attacker exploits misconfigured AI device to run AI-generated payload

Attacker exploits misconfigured AI device to run AI-generated payload

June 2, 2025
Search indexes with column granularity in BigQuery

Search indexes with column granularity in BigQuery

May 9, 2025
AWS Leads ‘Large 3’ in Cloud Market/Co-Promote Survey Report — AWSInsider

AWS Leads ‘Large 3’ in Cloud Market/Co-Promote Survey Report — AWSInsider

April 25, 2025
Oracle Database blogs so as to add to your RSS feeds

Execution plans in Oracle SQL Developer for VS Code

May 4, 2025
7 Greatest Cloud Primarily based Collaboration Software program

7 Greatest Cloud Primarily based Collaboration Software program

April 4, 2025

MultiCloud365

Welcome to MultiCloud365 — your go-to resource for all things cloud! Our mission is to empower IT professionals, developers, and businesses with the knowledge and tools to navigate the ever-evolving landscape of cloud technology.

Category

  • AI and Machine Learning in the Cloud
  • AWS
  • Azure
  • Case Studies and Industry Insights
  • Cloud Architecture
  • Cloud Networking
  • Cloud Platforms
  • Cloud Security
  • Cloud Trends and Innovations
  • Data Management
  • DevOps and Automation
  • GCP
  • IAC
  • OCI

Recent News

PowerAutomate to GITLab Pipelines | Tech Wizard

PowerAutomate to GITLab Pipelines | Tech Wizard

June 13, 2025
Runtime is the actual protection, not simply posture

Runtime is the actual protection, not simply posture

June 13, 2025
  • About Us
  • Privacy Policy
  • Disclaimer
  • Contact

© 2025- https://multicloud365.com/ - All Rights Reserved

No Result
View All Result
  • Home
  • Cloud Architecture
    • OCI
    • GCP
    • Azure
    • AWS
    • IAC
    • Cloud Networking
    • Cloud Trends and Innovations
    • Cloud Security
    • Cloud Platforms
  • Data Management
  • DevOps and Automation
    • Tutorials and How-Tos
  • Case Studies and Industry Insights
    • AI and Machine Learning in the Cloud

© 2025- https://multicloud365.com/ - All Rights Reserved