<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: rotem levi # Cloud Security</title>
    <description>The latest articles on DEV Community by rotem levi # Cloud Security (@rotem_levi).</description>
    <link>https://dev.to/rotem_levi</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F910480%2F2f575774-ac22-4981-8abf-828f22f49ba4.jpeg</url>
      <title>DEV Community: rotem levi # Cloud Security</title>
      <link>https://dev.to/rotem_levi</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/rotem_levi"/>
    <language>en</language>
    <item>
      <title>How to Plant Canary Tokens in Your AWS Environment</title>
      <dc:creator>rotem levi # Cloud Security</dc:creator>
      <pubDate>Fri, 04 Jul 2025 17:40:05 +0000</pubDate>
      <link>https://dev.to/rotem_levi/how-to-plant-canary-tokens-in-your-aws-environment-23jo</link>
      <guid>https://dev.to/rotem_levi/how-to-plant-canary-tokens-in-your-aws-environment-23jo</guid>
      <description>&lt;h2&gt;
  
  
  Why Cloud Breaches Often Go Undetected
&lt;/h2&gt;

&lt;p&gt;You’ve locked down your IAM roles, hardened your S3 buckets, and turned on GuardDuty — great.&lt;br&gt;
But here’s the problem:&lt;br&gt;
&lt;strong&gt;Attackers don’t always trigger alarms.&lt;/strong&gt;&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They quietly browse public buckets.&lt;/li&gt;
&lt;li&gt;They find leftover .env files.&lt;/li&gt;
&lt;li&gt;They scan for credentials in GitHub repos.&lt;/li&gt;
&lt;li&gt;And they move silently, often going undetected for weeks or months.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcvhcmp4g075xxmkk1oaw.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fcvhcmp4g075xxmkk1oaw.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Canary Tokens
&lt;/h2&gt;

&lt;p&gt;Canary Tokens are small, fake files or credentials designed to look real — but trigger alerts when someone touches them.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;They don’t block the attacker.&lt;/li&gt;
&lt;li&gt;They don’t interfere with your environment.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;They simply whisper:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;“Someone's here. You should take a look.”&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Tools like &lt;a href="https://canarytokens.org/nest/" rel="noopener noreferrer"&gt;Canarytokens.org&lt;/a&gt; make it super easy to create these traps — no infrastructure, no cost.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1dfdbrqbptaeqi519mw0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F1dfdbrqbptaeqi519mw0.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Use Cases in AWS
&lt;/h2&gt;

&lt;p&gt;Want to catch unauthorized access? Try this:&lt;/p&gt;

&lt;h3&gt;
  
  
  S3 Bucket Trap
&lt;/h3&gt;

&lt;p&gt;Drop a fake creds.txt or .env file in a low-profile S3 bucket.&lt;br&gt;
If someone opens it — boom, you get an alert.&lt;/p&gt;

&lt;h3&gt;
  
  
  GitHub Canary
&lt;/h3&gt;

&lt;p&gt;Generate a fake AWS Access Key and commit it on purpose to a private (or honeypot) repo.&lt;br&gt;
If someone tries to use it — instant notification.&lt;/p&gt;

&lt;h3&gt;
  
  
  Lambda or EC2
&lt;/h3&gt;

&lt;p&gt;Place a fake secrets file in EC2 user data or as an environment variable in a test Lambda function.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbj4ykk78jth5h4go4k35.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fbj4ykk78jth5h4go4k35.png" alt="Image description" width="800" height="533"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  How to Set One Up (Takes ~60 Seconds)
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;Go to &lt;a href="https://canarytokens.org/nest/" rel="noopener noreferrer"&gt;Canarytokens.org&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;Choose a token type (.env file, AWS key, QR code, etc.)&lt;/li&gt;
&lt;li&gt;Set your email or Slack webhook&lt;/li&gt;
&lt;li&gt;Download or copy the token&lt;/li&gt;
&lt;li&gt;Place it where attackers might find it&lt;/li&gt;
&lt;li&gt;Wait. If it’s accessed — you’ll know.&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Extra TIPs
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Use realistic names like config_backup.env, not DO_NOT_TOUCH_THIS_TOKEN.txt&lt;/li&gt;
&lt;li&gt;Place tokens where attackers actually look — dev folders, buckets, user data, etc.&lt;/li&gt;
&lt;li&gt;Rotate tokens occasionally&lt;/li&gt;
&lt;li&gt;Integrate alerts with your SOC or Slack #security channel&lt;/li&gt;
&lt;li&gt;Never rely on them as your only defense — they’re early warning, not a silver bullet&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Final Thought
&lt;/h2&gt;

&lt;p&gt;You don’t need to monitor everything.&lt;br&gt;
You just need one trap in the right place to know someone’s inside.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Start with one token. Place it smart. Sleep a little better.&lt;/p&gt;
&lt;/blockquote&gt;

</description>
      <category>aws</category>
      <category>security</category>
      <category>defense</category>
    </item>
    <item>
      <title>Securing Your AWS EC2 and S3 Communication: Best Practices for Enhanced Security</title>
      <dc:creator>rotem levi # Cloud Security</dc:creator>
      <pubDate>Sun, 10 Nov 2024 08:45:00 +0000</pubDate>
      <link>https://dev.to/rotem_levi/securing-your-aws-ec2-and-s3-communication-best-practices-for-enhanced-security-3pem</link>
      <guid>https://dev.to/rotem_levi/securing-your-aws-ec2-and-s3-communication-best-practices-for-enhanced-security-3pem</guid>
      <description>&lt;h2&gt;
  
  
  Securing Your AWS EC2 and S3 Communication: Best Practices for Enhanced Security
&lt;/h2&gt;

&lt;p&gt;Cloud security is more crucial than ever, especially in complex environments where numerous resources interact. Ensuring the protection of your AWS architecture requires a multi-layered approach. This blog post will walk you through a practical example using the diagram below to illustrate essential security measures for securing an EC2 instance accessing an S3 bucket.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview of the Architecture
&lt;/h2&gt;

&lt;p&gt;The diagram showcases an AWS environment where an EC2 instance communicates with an S3 bucket, with numbered components representing critical security checkpoints. Each number indicates a recommended security measure that fortifies the connection and protects data integrity.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8goqcws8d84r7cwoflu0.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2F8goqcws8d84r7cwoflu0.png" alt="Image description" width="800" height="444"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Detailed Breakdown of Security Measures
&lt;/h2&gt;

&lt;h3&gt;
  
  
  1. Use IAM Role
&lt;/h3&gt;

&lt;p&gt;Assigning an IAM role to the EC2 instance ensures that it has temporary, secure access to AWS resources without the need for hard-coded credentials. This practice reduces the risk of credential leakage and supports the principle of least privilege.&lt;/p&gt;

&lt;h3&gt;
  
  
  2. IAM Policy with Least-Privilege Access
&lt;/h3&gt;

&lt;p&gt;Design IAM policies that grant the minimum permissions needed. By implementing least-privilege access, you limit potential damage in case of compromised credentials and keep your AWS environment more secure.&lt;/p&gt;

&lt;h3&gt;
  
  
  3. Configure Security Group
&lt;/h3&gt;

&lt;p&gt;Security groups act as virtual firewalls for your EC2 instance, allowing you to control inbound and outbound traffic. Ensure that only necessary ports and IP addresses are permitted to minimize exposure to potential threats.&lt;/p&gt;

&lt;h3&gt;
  
  
  4. Use S3 Gateway Endpoint
&lt;/h3&gt;

&lt;p&gt;Set up an S3 Gateway Endpoint to ensure that data transferred between the EC2 instance and the S3 bucket stays within the AWS network, avoiding exposure to the public internet. This improves the overall security and performance of your environment.&lt;/p&gt;

&lt;h3&gt;
  
  
  5. Least Privilege S3 Gateway Endpoint Policy
&lt;/h3&gt;

&lt;p&gt;Configure the S3 Gateway Endpoint policy to allow only specific actions and restrict access to authorized resources. This enforces strict access control, making sure that only necessary operations are permitted.&lt;/p&gt;

&lt;h3&gt;
  
  
  6. Use SSE-KMS with Customer Managed Key
&lt;/h3&gt;

&lt;p&gt;For data at rest, use Server-Side Encryption (SSE) with AWS Key Management Service (KMS). By utilizing a customer-managed key, you maintain control over key rotation, access policies, and auditing. This ensures that sensitive data is encrypted and access is well-regulated.&lt;/p&gt;

&lt;h3&gt;
  
  
  7. Allow Only Secure Connection
&lt;/h3&gt;

&lt;p&gt;Ensuring that data transfer is secure is paramount. Enforce the use of HTTPS-only connections by:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;VPC Endpoint Policy&lt;/strong&gt;: Configure the policy to require HTTPS traffic using the &lt;code&gt;aws:SecureTransport&lt;/code&gt; condition set to &lt;code&gt;true&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Bucket Policy&lt;/strong&gt;: Apply a policy that mandates secure connections by also using &lt;code&gt;aws:SecureTransport&lt;/code&gt; set to &lt;code&gt;true&lt;/code&gt;. This guarantees encrypted data transfers and prevents unauthorized access.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  8. Configure Bucket Policy – Allow Access Only from S3 Endpoint
&lt;/h3&gt;

&lt;p&gt;Restrict S3 bucket access so that only traffic coming from your specific VPC endpoint is allowed. This ensures that public access is blocked and only internal traffic is permitted, adding an additional layer of security.&lt;/p&gt;

&lt;h3&gt;
  
  
  9. CloudTrail Logs
&lt;/h3&gt;

&lt;p&gt;Enable AWS CloudTrail to monitor and log all API activity within your environment. CloudTrail provides the necessary audit logs to detect unauthorized actions and support compliance requirements. Reviewing these logs regularly can help you spot anomalies and respond to incidents promptly.&lt;/p&gt;

&lt;h2&gt;
  
  
  Best Practices and Recommendations
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Continuous Monitoring&lt;/strong&gt;: Integrate AWS services like GuardDuty and AWS Config to monitor for misconfigurations and potential threats.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Regular Policy Reviews&lt;/strong&gt;: Audit and review IAM and bucket policies periodically to ensure they remain relevant and aligned with best practices.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Enforce MFA&lt;/strong&gt;: Use multi-factor authentication (MFA) for accessing the AWS Management Console and when making sensitive changes.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Automated Remediation&lt;/strong&gt;: Implement Lambda functions to automate responses to specific alerts or incidents.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Securing your AWS environment involves more than just initial setup—it requires ongoing vigilance and adaptation to new threats. By applying these security measures, you create a robust defense against unauthorized access and data breaches. Regularly assessing your cloud architecture and refining your security policies will help maintain a secure and compliant environment.&lt;/p&gt;

&lt;h2&gt;
  
  
  Call to Action
&lt;/h2&gt;

&lt;p&gt;Are there additional security practices you follow? Share your thoughts and insights in the comments. Let’s continue the conversation and keep our cloud environments secure together!&lt;/p&gt;

</description>
      <category>aws</category>
      <category>security</category>
      <category>ec2</category>
      <category>s3</category>
    </item>
    <item>
      <title>Listing All AWS Lambda functions with Runtime end of support(across all regions)</title>
      <dc:creator>rotem levi # Cloud Security</dc:creator>
      <pubDate>Wed, 17 Aug 2022 14:01:00 +0000</pubDate>
      <link>https://dev.to/rotem_levi/listing-all-aws-lambda-functions-that-will-that-runtime-end-of-supportacross-all-regions-31k8</link>
      <guid>https://dev.to/rotem_levi/listing-all-aws-lambda-functions-that-will-that-runtime-end-of-supportacross-all-regions-31k8</guid>
      <description>&lt;p&gt;In the post, there is an AWS CLI / AWS CloudShell command that lists all  Lambda functions that have Runtime end of support.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Script:&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;runtimes=("dotnetcore3.1" "nodejs12.x" "dotnetcore2.1" "python3.6" "python2.7" "ruby2.5" "nodejs10.x" "nodejs8.10" "nodejs6.10" "nodejs4.3-edge" "nodejs4.3" "nodejs")
for region in `aws ec2 describe-regions --query "Regions[].RegionName" --region us-west-1 --output text`
do
    echo "[${region}]"
    for runtime in ${runtimes[@]}
    do
        aws lambda list-functions --region ${region} --output text --query "Functions[?Runtime=='${runtime}'].{ARN:FunctionArn, Runtime:Runtime}"
    done
done
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Usage AWS CLI&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;export AWS_PROFILE=xxxx # Not necessary if you always set the default profile.
sh ListingLambdaEOS.sh
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Usage AWS CloudShell&lt;/strong&gt;&lt;br&gt;
Just copy the Script and run in your CloudShell.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Output&lt;/strong&gt;&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;[eu-north-1]
[ap-south-1]
[eu-west-3]
[eu-west-2]
[eu-west-1]
[ap-northeast-3]
[ap-northeast-2]
[ap-northeast-1]
arn:aws:lambda:ap-northeast-1:111111111111:function:bla   python2.7
arn:aws:lambda:ap-northeast-1:111111111111:function:blalba   python3.6
[ca-central-1]
[ap-east-1]
[ap-southeast-1]
[ap-southeast-2]
[eu-central-1]
[us-east-1]
arn:aws:lambda:us-east-1:111111111111:function:testx node12
[us-east-2]
[us-west-1]
[us-west-2]
arn:aws:lambda:us-west-2:111111111111:function:testz rubi
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Reference&lt;/strong&gt;&lt;br&gt;
&lt;a href="https://docs.aws.amazon.com/lambda/latest/dg/lambda-runtimes.html" rel="noopener noreferrer"&gt;Lambda runtimes&lt;/a&gt;&lt;br&gt;
&lt;a href="https://aws.amazon.com/cli/" rel="noopener noreferrer"&gt;AWS Command Line Interface&lt;/a&gt;&lt;/p&gt;

</description>
      <category>shell</category>
      <category>aws</category>
      <category>lambda</category>
    </item>
  </channel>
</rss>
