Journal 130 — Unity App Development, AWS Setup Part 2
Objective: To prepare the next part of AWS setup to be able to view my S3 Bucket
In one of the previous journals, I set up an AWS account. Now I want to continue from those steps and be able to view the S3 Bucket I created to store my app data files.
We need to go through a few steps first before being able to save our app data to AWS. The first step is to set up an Identity Pool through Amazon Cognito.
The overall goal looks like this diagram: We’ll use the app to access an Identity Pool to then access Amazon S3, which stores and retrieves the user data files from the app. Eventually, we can set up a User Pool so each user could sign in to the app and prepare their own data.
Amazon Cognito Identity Pool
In Amazon Cognito, I will manage my identities, and create an Identity Pool
After going through this process, you can view the details of the Identity Pool. We will need this Identity pool ID later in the scripting to access AWS.
AWSAssets in Unity 2021
As mentioned in the previous article, using later versions of Unity is a bit more of a manual setup process to download and import the correct DLL files.
In my case, I imported the following per this guide.
After this, I imported these files to Unity Assets in a folder called AWS Assemblies.
Amazon S3 Bucket
Now at Amazon S3, I need to create a bucket to store and retrieve the data.
Now let’s make an empty game object and a new script called AWSManager.
We will need to create credentials so we can log into Amazon.
IAM Policy to Access S3
We will then need to generate a policy to access S3.
Create Bucket Policy in S3
Copy the Role ARN and head over to S3 where the new bucket was created. Select the bucket and go to Permissions and Edit the Bucket Policy.
Then create a new policy and paste in the Role ARN from IAM into the “Principal” field, allow all actions, and format the ARN as described in the format. Then you select Add Statement and Generate Policy, which will prepare a Policy JSON document that you can copy and paste into the S3 Bucket Policy.
AWSManager Get Bucket List
Now with these policies and permissions in place, we can update the AWSManager to test and see if we can view the S3 Bucket list.
Finally, here are the results to check. As you saw earlier, I made one bucket, so I’m trying to verify the connectivity. It works!
Thank you for your time!