Close Menu
5gantennas.org5gantennas.org
  • Home
  • 5G
    • 5G Technology
  • 6G
  • AI
  • Data
    • Global 5G
  • Internet
  • WIFI
  • 5G Antennas
  • Legacy

Subscribe to Updates

Subscribe to our newsletter and never miss our latest news

Subscribe my Newsletter for New Posts & tips Let's stay updated!

What's Hot

4 Best Wi-Fi Mesh Networking Systems in 2024

September 6, 2024

India is on the brink of a new revolution in telecommunications and can lead the world with 6G: Jyotiraditya Scindia

August 29, 2024

Speaker Pelosi slams California AI bill headed to Governor Newsom as ‘ignorant’

August 29, 2024
Facebook X (Twitter) Instagram
Facebook X (Twitter) Instagram
5gantennas.org5gantennas.org
  • Home
  • 5G
    1. 5G Technology
    2. View All

    Deutsche Telekom to operate 12,500 5G antennas over 3.6 GHz band

    August 28, 2024

    URCA Releases Draft “Roadmap” for 5G Rollout in the Bahamas – Eye Witness News

    August 23, 2024

    Smart Launches Smart ZTE Blade A75 5G » YugaTech

    August 22, 2024

    5G Drone Integration Denmark – DRONELIFE

    August 21, 2024

    Hughes praises successful private 5G demo for U.S. Navy

    August 29, 2024

    GSA survey reveals 5G FWA has become “mainstream”

    August 29, 2024

    China Mobile expands 5G Advanced, Chunghwa Telecom enters Europe

    August 29, 2024

    Ateme and ORS Boost 5G Broadcast Capacity with “World’s First Trial of IP-Based Statmux over 5G Broadcast” | TV Tech

    August 29, 2024
  • 6G

    India is on the brink of a new revolution in telecommunications and can lead the world with 6G: Jyotiraditya Scindia

    August 29, 2024

    Vodafonewatch Weekly: Rural 4G, Industrial 5G, 6G Patents | Weekly Briefing

    August 29, 2024

    Southeast Asia steps up efforts to build 6G standards

    August 29, 2024

    Energy efficiency as an inherent attribute of 6G networks

    August 29, 2024

    Finnish working group launches push for 6G technology

    August 28, 2024
  • AI

    Speaker Pelosi slams California AI bill headed to Governor Newsom as ‘ignorant’

    August 29, 2024

    Why Honeywell is betting big on Gen AI

    August 29, 2024

    Ethically questionable or creative genius? How artists are engaging with AI in their work | Art and Design

    August 29, 2024

    “Elon Musk and Trump” arrested for burglary in disturbing AI video

    August 29, 2024

    Nvidia CFO says ‘enterprise AI wave’ has begun and Fortune 100 companies are leading the way

    August 29, 2024
  • Data
    1. Global 5G
    2. View All

    Global 5G Enterprise Market is expected to be valued at USD 34.4 Billion by 2032

    August 12, 2024

    Counterpoint predicts 5G will dominate the smartphone market in early 2024

    August 5, 2024

    Qualcomm’s new chipsets will power affordable 5G smartphones

    July 31, 2024

    Best Super Fast Download Companies — TradingView

    July 31, 2024

    Crypto Markets Rise on Strong US Economic Data

    August 29, 2024

    Microsoft approves construction of third section of Mount Pleasant data center campus

    August 29, 2024

    China has invested $6.1 billion in state-run data center projects over two years, with the “East Data, West Computing” initiative aimed at capitalizing on the country’s untapped land.

    August 29, 2024

    What is the size of the clinical data analysis solutions market?

    August 29, 2024
  • Internet

    NATO believes Russia poses a threat to Western internet and GPS services

    August 29, 2024

    Mpeppe grows fast, building traction among Internet computer owners

    August 29, 2024

    Internet Computer Whale Buys Mpeppe (MPEPE) at 340x ROI

    August 29, 2024

    Long-term internet computer investor adds PEPE rival to holdings

    August 29, 2024

    Biden-Harris Administration Approves Initial Internet for All Proposals in Mississippi and South Dakota

    August 29, 2024
  • WIFI

    4 Best Wi-Fi Mesh Networking Systems in 2024

    September 6, 2024

    Best WiFi deal: Save $200 on the Starlink Standard Kit AX

    August 29, 2024

    Sonos Roam 2 review | Good Housekeeping UK

    August 29, 2024

    Popular WiFi extender that eliminates dead zones in your home costs just $12

    August 29, 2024

    North American WiFi 6 Mesh Router Market Size, Share, Forecast, [2030] – அக்னி செய்திகள்

    August 29, 2024
  • 5G Antennas

    Nokia and Claro bring 5G to Argentina

    August 27, 2024

    Nokia expands FWA portfolio with new 5G devices – SatNews

    July 25, 2024

    Deutsche Telekom to operate 12,150 5G antennas over 3.6 GHz band

    July 24, 2024

    Vodafone and Ericsson develop a compact 5G antenna in Germany

    July 12, 2024

    Vodafone and Ericsson unveil new small antennas to power Germany’s 5G network

    July 11, 2024
  • Legacy
5gantennas.org5gantennas.org
Home»Data»Invoke an AWS Lambda function from cross-account Amazon Kinesis Data Streams
Data

Invoke an AWS Lambda function from cross-account Amazon Kinesis Data Streams

5gantennas.orgBy 5gantennas.orgMarch 20, 2024No Comments8 Mins Read
Facebook Twitter Pinterest LinkedIn Tumblr Email
Share
Facebook Twitter LinkedIn Pinterest WhatsApp Email


AWS’s multi-account architecture is essential for improving security, compliance, and resource management by separating workloads, enabling granular cost allocation, and facilitating collaboration across different environments. It also reduces risk, increases scalability, and enables advanced network configurations.

In a streaming architecture, event producers, stream storage, and event consumers can be in one account or distributed across different accounts, depending on your business and IT requirements. For example, your company may want to centralize clickstream and log data from several different producers across different accounts. Data consumers in marketing, product engineering, or analytics need access to the same streaming data across accounts, which requires the ability to provide a multi-account streaming architecture.

To build a multi-account streaming architecture, you can use Amazon Kinesis Data Streams as your stream storage and AWS Lambda as your event consumer. Amazon Kinesis Data Streams enables real-time processing of streaming data at scale. Integrating with Lambda enables serverless data processing, allowing you to analyze and act on data streams in real-time without managing infrastructure. This integration supports a variety of use cases including real-time analytics, log processing, Internet of Things (IoT) data ingestion, and more, making it valuable for enterprises that need timely insights from streaming data. This post shows you how to process data ingested into a stream from one account using a Lambda function from another account.

With the recently released support for resource-based policies in Kinesis Data Streams, you can now invoke Lambda from another account. Resource-based policies allow you to specify the AWS account, AWS Identity and Access Management (IAM) user, or IAM role, and the exact Kinesis Data Streams actions to grant access. Once access is granted, you can configure his Lambda function in another account to start processing data streams belonging to your account. This eliminates the need to use Lambda functions to copy streaming data in both accounts, reducing costs and simplifying data processing pipelines. There are no additional charges to your account for sharing data streams or access to registered consumers. Cross-account usage of Kinesis Data Streams resources continues to be billed to the resource owner.

In this post, we use Kinesis Data Streams with enhanced fan-out capabilities to provide consumers with dedicated read throughput tailored to their applications. By default, Kinesis Data Streams provides shared read throughput of 2 MB/s per shard between consumers, but with enhanced fan-out each consumer can enjoy a dedicated throughput of 2 MB/s per shard. Masu. This flexibility allows you to seamlessly adapt Kinesis Data Streams to your specific requirements, choosing between dedicated or shared throughput scalable fan-outs depending on your needs.

Solution overview

This solution deploys Kinesis Data Streams in Account 1 and deploys Lambda as a consumer in Account 2 to receive data from the data stream. The following diagram shows the high-level architecture.

Amazon KDS-Lambda Cross-Account Solution Architecture

Setup requires the following key elements:

  • Kinesis data stream in account 1 and Lambda function in account 2
  • Kinesis Data Streams resource policy for Account 1. Enables cross-account Lambda execution roles to perform operations on Kinesis data streams.
  • The Lambda execution role in Account 2 and the enhanced fan-out consumer resource policy in Account 1 enable the cross-account Lambda execution role to perform operations on Kinesis data streams.

The setup uses three AWS CloudFormation templates to create key resources.

  • CloudFormation Template 1 creates the following major resources in Account 1:
    • Kinesis data stream
    • Enhanced fan-out consumer for Kinesis data streams
  • CloudFormation Template 2 creates the following major resources in Account 2:
    • consumer lambda function
    • Consumer Lambda function execution role
  • CloudFormation template 3 creates the following resources in account 2.
    • Event source mapping for consumer Lambda functions

This solution supports single-region deployment, and CloudFormation templates must be deployed to the same region across different AWS accounts. This solution uses enhanced fanout for Kinesis Data Streams. This is a best practice for deploying architectures that require high throughput across multiple consumers. To deploy this solution, complete the steps in the following section.

Prerequisites

You need two AWS accounts and the necessary permissions to run the CloudFormation template and create the services described in the solution architecture. Additionally, you must have AWS Command Line Interface (AWS CLI) version 2.15 or later installed.

Launch CloudFormation template 1

To launch your first CloudFormation template, follow these steps:

  1. Sign in to the AWS Management Console as Account 1 and choose the appropriate AWS Region.
  2. Download and launch CloudFormation template 1 that deploys Kinesis data streams.
  3. for LambdaConsumerAccountIdenter your Lambda consumer account ID, and[送信]Click. It takes a few minutes for the CloudFormation template deployment to complete.
  4. Once the stack is complete, navigate to the stack in the AWS CloudFormation console. output Click the tab and copy the values ​​for the following parameters.
    • KinesisStreamArn
    • KinesisStreamEFOConsumerArn
    • KMSKeyArn

You will need these values ​​in a later step.

Launch CloudFormation template 2

To launch the second CloudFormation template, follow these steps:

  1. Sign in to the console as Account 2 and select the appropriate region.
  2. Download and launch CloudFormation template 2 that hosts the Lambda consumer.
  3. Specify the following input parameters obtained in the previous step.
    • KinesisStreamArn
    • KinesisStreamEFOConsumerArn
    • KMSKeyArn

The CloudFormation template creates the following major resources:

  • lambda consumer
  • Lambda execution role

A Lambda function’s execution role is an IAM role that grants your function permissions to access AWS services and resources. Now, create a Lambda execution role with the necessary Kinesis Data Streams and Lambda invocation permissions.

It takes a few minutes for the CloudFormation template deployment to complete.

  1. Once the stack is complete, navigate to the stack in the AWS CloudFormation console. output Click the tab and copy the values ​​for the following parameters.
    • KinesisStreamCreateResourcePolicyCommand
    • KinesisStreamEFOConsumerCreateResourcePolicyCommand
  2. Run the following AWS CLI command in Account 1 using AWS CloudShell. We recommend using CloudShell because it includes the latest version of the AWS CLI and avoids all types of failures.
    • KinesisStreamCreateResourcePolicyCommand – This creates a resource policy for Kinesis Data Stream in Account 1. Below is a sample resource policy.
      {
      "Version": "2012-10-17",
      "Statement": [
      {
      "Sid": "StreamEFOReadStatementID",
      "Effect": "Allow",
      "Principal": {
      "AWS": [
      "arn:aws:iam::<AWS Lambda - Consumer account id>:role/kds-cross-account-stream-consumer-lambda-execution-role"
      ]
      },
      "Action": [
      "kinesis:DescribeStreamSummary",
      "kinesis:ListShards",
      "kinesis:DescribeStream",
      "kinesis:GetRecords",
      "kinesis:GetShardIterator"
      ],
      "Resource": "arn:aws:kinesis:<region id>:<Account 1 - Amazon KDS account id>:stream/kds-cross-account-stream"
      }
      ]
      }

    • KinesisStreamEFOConsumerCreateResourcePolicyCommand – This creates a resource policy for the enhanced fan-out consumer for Kinesis data streams in Account 1. Below is a sample resource policy.
      {
      "Version": "2012-10-17",
      "Statement": [
      {
      "Sid": "ConsumerEFOReadStatementID",
      "Effect": "Allow",
      "Principal": {
      "AWS": [
      " arn:aws:iam::<AWS Lambda - Consumer account id>:role/kds-cross-account-stream-consumer-lambda-execution-role"
      ]
      },
      "Action": [
      "kinesis:DescribeStreamConsumer",
      "kinesis:SubscribeToShard"
      ],
      "Resource": "arn:aws:kinesis:<region id>:<Account 1 - Amazon KDS account id>:stream/kds-cross-account-stream/consumer/kds-cross-account-stream-efo-consumer:1706616477"
      }
      ]
      }

You can also access this policy from the following locations in the Kinesis Data Streams console: Enhanced fan-out, consumer nameand Consumer shared resource-based policy.

Launch CloudFormation template 3

Now that you have created a resource policy for your Kinesis data stream and its enhanced fanout consumer in Account 1, you can create a Lambda event source mapping for your consumer Lambda function in Account 2. Follow these steps:

  1. Sign in to the console as Account 2 and select the appropriate region.
  2. Download and launch CloudFormation Template 3 to update the stack that you created using CloudFormation Template 2.

A CloudFormation template creates a Lambda event source mapping.

Validate the solution

At this point, the deployment is complete. Kinesis data streams can be used to consume messages, and Lambda functions receive these messages in the destination account. To send a sample message to the data stream in Account 1, run the following AWS CLI command using CloudShell.

aws kinesis put-record --stream-name kds-cross-account-stream --data sampledatarecord --partition-key samplepartitionkey3 --region <region id>

The Lambda function in account 2 should be able to receive messages and you should be able to verify the same using Amazon CloudWatch logs.

  1. In the CloudWatch console, log group in the navigation pane.
  2. Locate the log group /aws/lambda/kds-cross-account-stream-efo-consumer.
  3. choose Search for log groups View related log messages. Below is an example message.
    "Records": [
    {
    "kinesis": {
    "kinesisSchemaVersion": "1.0",
    "partitionKey": "samplepartitionkey3",
    "sequenceNumber": "49648798411111169765201534322676841348246990356337393698",
    "data": "sampledatarecord",
    "approximateArrivalTimestamp": 1706623274.658
    },

cleaning

It is always recommended to clean up all resources created as part of this post to avoid additional costs.

To clean up your resources, remove the respective CloudFormation stacks from accounts 1 and 2 to stop the producers from pushing events to your Kinesis data stream. This will prevent you from being charged unnecessary fees.

summary

In this post, you learned how to configure cross-account Lambda and Kinesis Data Streams integration using AWS resource-based policies. This allows data ingested into a stream in one AWS account to be processed through a Lambda function in another account. To support customers who use Kinesis data streams in a central account and have multiple consumers reading data from them, we used the enhanced fan-out capabilities of Kinesis Data Streams.

To get started, open the Kinesis Data Streams console or use the new API PutResourcePolicy to attach a resource policy to your data stream or consumer.


About the author

Pratik Patel Senior Technical Account Manager and Streaming Analytics Specialist. He works with his AWS customers to help plan and build solutions using best practices, and provides ongoing support and technical guidance to keep customers’ AWS environments proactively and operationally healthy. It offers.

Amar I am a Senior Solutions Architect at Amazon AWS in the UK. He works on strategic implementations across power, utilities, manufacturing, and automotive customers, and he specializes in using AWS streaming and advanced data analytics solutions to drive optimal business outcomes.



Source link

Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
Previous ArticleKeysight (KEYS) partners with NVIDIA to accelerate AI-native 6G research – March 20, 2024
Next Article GitHub’s latest AI tools can automatically fix vulnerabilities in your code
5gantennas.org
  • Website

Related Posts

Crypto Markets Rise on Strong US Economic Data

August 29, 2024

Microsoft approves construction of third section of Mount Pleasant data center campus

August 29, 2024

China has invested $6.1 billion in state-run data center projects over two years, with the “East Data, West Computing” initiative aimed at capitalizing on the country’s untapped land.

August 29, 2024
Leave A Reply Cancel Reply

You must be logged in to post a comment.

Latest Posts

4 Best Wi-Fi Mesh Networking Systems in 2024

September 6, 2024

India is on the brink of a new revolution in telecommunications and can lead the world with 6G: Jyotiraditya Scindia

August 29, 2024

Speaker Pelosi slams California AI bill headed to Governor Newsom as ‘ignorant’

August 29, 2024

Crypto Markets Rise on Strong US Economic Data

August 29, 2024
Don't Miss

Business News | Communications Minister Scindia promotes 6G leadership and nationwide broadband in meeting with telecom operators

By 5gantennas.orgAugust 24, 2024

New Delhi [India]August 24 (ANI): Union Telecom Minister Jyotiraditya Scindia along with Minister of State…

SingTel and SK Telecom prepare for the 6G future

July 8, 2024

Apple focuses on 6G for future iPhones

December 11, 2023

Subscribe to Updates

Subscribe to our newsletter and never miss our latest news

Subscribe my Newsletter for New Posts & tips Let's stay updated!

About Us
About Us

Welcome to 5GAntennas.org, your reliable source for comprehensive information on 5G technology, artificial intelligence (AI), and data-related advancements. We are passionate about staying at the forefront of these cutting-edge fields and bringing you the latest insights, trends, and developments.

Facebook X (Twitter) Pinterest YouTube WhatsApp
Our Picks

4 Best Wi-Fi Mesh Networking Systems in 2024

September 6, 2024

India is on the brink of a new revolution in telecommunications and can lead the world with 6G: Jyotiraditya Scindia

August 29, 2024

Speaker Pelosi slams California AI bill headed to Governor Newsom as ‘ignorant’

August 29, 2024
Most Popular

Will 5G make 2024 the most connected year in the industry?

December 1, 2023

The current state of 5G in the US and how it can improve

September 28, 2023

How 5G technology will transform gaming on the go

January 31, 2024
© 2025 5gantennas. Designed by 5gantennas.
  • Home
  • About us
  • Contact us
  • DMCA
  • Privacy Policy
  • About Creator

Type above and press Enter to search. Press Esc to cancel.