function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
prasad vivekprasad vivek 

Hi I have a scenario where i have to insert bucket in AWS S3 from sfdc, So how do I do that, Iam not able to do so.

MY Code is Given as below.

<apex:page controller="Amazon_S3_Configuration_Controller" standardStylesheets="false" setup="false"  lightningStyleSheets="true">
    
    <style type="text/css">
        /* To style the modal*/
        .Popup{ 
        background-color: white;
        border-width: 2px;
        border-style: solid;
        z-index: 9999;
        left: 50%;
        padding:10px;
        position: absolute;
        /* These are the 3 css properties you will need to change so the popup 
        displays in the center of the screen. First set the width. Then set 
        margin-left to negative half of what the width is. You can add 
        the height property for a fixed size pop up if you want.*/
        width: 60%;
        margin-left: -350px;
        top:100px;
        }
        
        .popupBackground{
        background-color:black;
        opacity: 0.20;
        filter: alpha(opacity = 20);
        position: absolute;
        width: 100%;
        height: 100%;
        top: 0;
        left: 0;
        z-index: 9998;
        }
        
    </style>
    
    <!-- Aws S3 Upload code -->
    <script src="https://sdk.amazonaws.com/js/aws-sdk-2.1.12.min.js"></script>
         <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
   
   
    <apex:slds >
       
            <apex:form >
                
               <apex:form> 
    </apex:slds>
     <script type="text/javascript">
    
     AWS.config.update(
            {
                accessKeyId: "12345xyz",
                secretAccessKey: "wedfghjk",
                region_config: "us-east-1" 
            }
        );
    
    
    function createAwsBucket(){
        
       
        
        alert('inside create bucket');
        alert('bucket name'+'{!Bucket_Name}')
        
        //var awsbucketname='{!Bucket_Name}';
        var params={
            Bucket: "CRMA Folder",
            CreateBucketConfiguration: {
                   LocationConstraint: "us-east-1"
              }
        }
        
        
        alert('params'+JSON.stringify(params));
        var s=new Aws.s3();
        
        s.createBucket(params, function(err, data) {
                   if (err) console.log(err, err.stack); // an error occurred
                   else {
                    alert('success');
                    console.log(data);  // successful response
                }
        });
        
        
        }
    </script>                                                                                                                                                      
</apex:page>


Iam Calling this JS function from a button.