AWS S3 cross account access with Lambda and sts AssumeRole | Fine grained control with Bucket Policy

  Рет қаралды 2,606

Beyond The Cloud

Beyond The Cloud

Күн бұрын

Пікірлер: 18
@beyondthecloud
@beyondthecloud Жыл бұрын
Please provide your valuable feedback in the comment section. Please like share and subscribe for more upcoming content.
@EdwardSileo
@EdwardSileo Жыл бұрын
So, I think, I have looked at EVERY youtube video on cross account access, and this is the one that actually works. I finally understand it too: The lambda role has to have assume role of the other account role, and the other account role has to have a trust relationship with the lambda role. That was the secret sauce / Rosetta Stone for me . Thank you, thank you, thank you.
@beyondthecloud
@beyondthecloud Жыл бұрын
Thanks lot for your comment. Really glad you liked the content and it was helpful.
@pupun813
@pupun813 Жыл бұрын
Very nice. Yes Lambda access is very useful in multiple use cases
@beyondthecloud
@beyondthecloud Жыл бұрын
Yes, true
@bepositive6525
@bepositive6525 Жыл бұрын
👍🏻
@yogibisai647
@yogibisai647 Жыл бұрын
Very useful
@beyondthecloud
@beyondthecloud Жыл бұрын
Glad you think so!
@vaibhavjain1in
@vaibhavjain1in 4 ай бұрын
Hey bro, I need some help with AWS. Would you please help me with a small project?
@ammarkhalid2872
@ammarkhalid2872 3 ай бұрын
what to do if we are using ec2 instead of lambda ??
@beyondthecloud
@beyondthecloud 3 ай бұрын
for your use case please find the below link. Same use case I have explained. kzbin.info/www/bejne/qZzYpaGqdrd0nNk
@shovan3112
@shovan3112 11 ай бұрын
Can you please help me with a few lines on code the same lambda fuction - how to copy files as well (cross account). Bucket name and path (sub-folders) for source and target can come from variables. You've already given FullS3Access policy so shouldn't be a problem it should work. Please share the code for this.
@beyondthecloud
@beyondthecloud 9 ай бұрын
To copy the contents of one S3 bucket to another using AWS Lambda in Python, you can use the boto3 library, which is the official AWS SDK for Python. Make sure you have the boto3 library included in your Lambda deployment package. Here's a simple example Lambda function that copies the contents of one S3 bucket to another: import boto3 def lambda_handler(event, context): source_bucket = 'your-source-bucket' destination_bucket = 'your-destination-bucket' # Create an S3 client s3 = boto3.client('s3') # List all objects in the source bucket objects = s3.list_objects(Bucket=source_bucket)['Contents'] # Copy each object to the destination bucket for obj in objects: key = obj['Key'] copy_source = {'Bucket': source_bucket, 'Key': key} destination_key = key # You can modify this if you want to change the key in the destination bucket s3.copy_object(CopySource=copy_source, Bucket=destination_bucket, Key=destination_key) return { 'statusCode': 200, 'body': 'S3 content copied successfully!' } Remember to replace 'your-source-bucket' and 'your-destination-bucket' with your actual source and destination bucket names. Note: Ensure that the Lambda execution role has the necessary permissions to read from the source S3 bucket and write to the destination S3 bucket. The role should at least have the AmazonS3ReadOnlyAccess and AmazonS3FullAccess policies attached.
@MohamedRoushdy
@MohamedRoushdy 2 ай бұрын
Would you mind sharing your python code with us? Thank you in advance.
@beyondthecloud
@beyondthecloud Ай бұрын
Yes sure, dis you check the description box?
@user-rd8td7es3w
@user-rd8td7es3w 8 ай бұрын
RoleSessionName :- Need your hep to understand this. I'm unable to get this info.
@beyondthecloud
@beyondthecloud 7 ай бұрын
Thanks for your comment. What are you unable to understand?
@user-rd8td7es3w
@user-rd8td7es3w 7 ай бұрын
I was confused about "RoleSessionName". From where we can get that. But now i got that solution.
He bought this so I can drive too🥹😭 #tiktok #elsarca
00:22
Elsa Arca
Рет қаралды 47 МЛН
大家都拉出了什么#小丑 #shorts
00:35
好人小丑
Рет қаралды 85 МЛН
The FASTEST way to PASS SNACKS! #shorts #mingweirocks
00:36
mingweirocks
Рет қаралды 15 МЛН
Electric Flying Bird with Hanging Wire Automatic for Ceiling Parrot
00:15
Develop Lambdas Locally in VS Code Using AWS SAM | AWS Lambda Tutorial
15:50
He bought this so I can drive too🥹😭 #tiktok #elsarca
00:22
Elsa Arca
Рет қаралды 47 МЛН