1 / 6

How To Upload the profile images to AWS S3 Bucket

Lia infraservices-being an AWS partner company, we always use AWS cloud migration services to ensure durable application for our customers. The AWS cloud migration is the path to reduce the TCO and increase the productivity of an organization.<br><br>

StephieJohn
Télécharger la présentation

How To Upload the profile images to AWS S3 Bucket

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. How To Upload the profile images to AWS S3 Bucket Lia infraservices-being an AWS partner company, we always use AWS cloud migration services to ensure the durable application for our customers. The AWS cloud migration is the path to reduce the TCO and increase the productivity of an organization. We have decided to use AWS S3 and the AWS Cognito service for any user to store their profile picture while registering into the mobile application. What we have done: 1. Created an S3 bucket in the Bahrain region as our customer was from the Middle east, and so to reduce the latency, we wanted to have all the services in that region. 2. Set up the permissions necessary like bucket policy and CORS.

  2. How to upload the profile images to AWS S3 bucket { “Version”: “2012-10-17”, “Id”: “Policy1626866950426”, “Statement”: [ { “Sid”: “Stmt1626866945113”, “Effect”: “Allow”, “Principal”: “*”, “Action”: “s3:*”, “Resource”: “arn:aws:s3:::bucket_name/*” } ] } CORS

  3. [ { “AllowedHeaders”: [ “*” ], “AllowedMethods”: [ “PUT”, “POST”, “DELETE” ], “AllowedOrigins”: [ “*” ], “ExposeHeaders”: [] },

  4. { “AllowedHeaders”: [], “AllowedMethods”: [ “GET” ], “AllowedOrigins”: [ “*” ], “ExposeHeaders”: [] } ] Therefore Once the bucket was created, we had to enable AWS Cognito to allow the user to authenticate to access AWS resources. From the Cognito console, selected “Manage Identity Pool” Gave a name to the identity pool

  5. Under “Unauthenticated identities“ Enabled the access to unauthenticated identities Created the Pool. That automatically created two IAM roles 1. 2. Unauthenticated role Authenticated role Note: To make the permission even granular, we can add the S3 bucket the Cognito to have permission to. But, in our case, we did not need to do any changes to the existing inline policy. Once all are set correctly, provided the information to the developer as BUCKET_NAME=”Bucket_name” ENDPOINT=”https://s3.me-south-1.amazonaws.com” BASE_S3_URL=”https://s3.me-south-1.amazonaws.com/bucket_name/” POOL_ID=”me-south-1:ec9f9bfe-5c19-419a-91bc-f757957d080e” The Android developers updated that into their code, Once they upload the code and tried to test, they were getting the error as below

  6. IdentityPool ‘me-south-1:ec9f9bfe-5c19-419a-91bc-f757957d080e’ not found. (Service: AmazonCognitoIdentity; Status Code: 400; Error Code: ResourceNotFoundException; Request ID: a9cb68-9e9a-4693-aa34-9ca45e) After some research, it was found that the S3 service in the Bahrain region does not accept any data transfer, it needs some other component to get that done. To reduce the overhead, we decided to move the S3 bucket and Cognito to other supported AWS regions and then the code was working fine. The application was able to upload the user profile during the registration. Conclusion Lia infraservices AWS cloud migration Ensure data integrity & security as our primary focus. Migrate Your Data To A More Safe and Secure Cloud Platform using lia infraservices cloud migration services . Click on the link to know more about the AWS cloud migration services REFERENCE To know more about how to Add a bucket policy using the Amazon S3 console

More Related