Git Product home page Git Product logo

Comments (3)

verhagenkava avatar verhagenkava commented on August 17, 2024

I'm currently having the same issue.

Did you manage to solve it?

Thanks, Kava.

from aws-deeplens-worker-safety-project.

uhofemeier avatar uhofemeier commented on August 17, 2024

I have not.

from aws-deeplens-worker-safety-project.

paulbright avatar paulbright commented on August 17, 2024

from https://forums.aws.amazon.com/thread.jspa?threadID=287187

Create policy

  1. go to IAM console https://console.aws.amazon.com/iam/home?region=us-east-1
  2. on the left panel, click on "policies", then click "create policy"
  3. on the next page, click on "choose a service", then choose "s3"
  4. for "actions", you can pick "list", "read" and "write" for now, you can revise the permission later.
  5. for "resources", you can specify bucket and object by providing the ARNs, or choose "all resources" to allow access to all your s3 resources
  6. you don't need to specify "request conditions"
  7. click "review policy" to go to the next page
  8. review policy and choose a name for the policy, then click "create policy"
  9. go back to IAM console, click on "roles", you should see "AWSDeepLensGreengrassGroupRole"
  10. click on that role, then click on "attach policy", choose the policy you just created.

You can find more information about IAM policy here: https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_create.html

and my code is

import boto3
from botocore.session import Session

def write_image_to_s3(cv2frame):
    session = Session()
    creds = session.get_credentials()
    s3 = session.create_client('s3',
        aws_access_key_id=creds.access_key, 
        aws_secret_access_key=creds.secret_key,
        aws_session_token=creds.token)

    file_name = 'xyz.jpg'
    encode_param=[int(cv2.IMWRITE_JPEG_QUALITY),90]
    _, jpg_data = cv2.imencode('.jpg', cv2frame, encode_param)
    response = s3.put_object(Bucket="yourbucketname", Body=jpg_data.tostring(),Key=file_name)

from aws-deeplens-worker-safety-project.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.