How do I access the AWS PHP SDK on EC2? - amazon-web-services

I have gotten to know that the AWS SDK comes with the default operating system installed on AWS EC2 when provisioned via Elastic Beanstalk.
I would like to know if I can access the PHP version of the SDK.
Or does it need to be installed separately.
Thank you.

You have to Install it using phar or composer , Please Refer AWS Documentation for this:
To use Composer with the AWS SDK for PHP:
Open a terminal window and navigate to the directory where your
project is stored. Composer is installed on a per-project basis.
Download and install Composer in your project directory. If you have
curl installed, you can use the following command:
curl -sS https://getcomposer.org/installer | php
Create a file at the root level of your project called composer.json
and add the following dependency for the AWS PHP SDK:
{
"require": {
"aws/aws-sdk-php": "2.*"
}
}
Install the dependencies by running Composer's install command:
php composer.phar install
This will create a vendor directory in your project with the required libraries and an autoloader script used to load them for your project.
Require Composer's autoloader by adding the following line to your
code's bootstrap process (typically in index.php):
require '/path/to/sdk/vendor/autoload.php';
Your code is now ready to use the AWS SDK for PHP!

Related

Azure FTPS How to find the deployed project files

I am using Azure FTP to update the project files after they are deployed via CLI
I get to /site/wwwroot
I see a tar file, where do I find all the project files.
Requirement is to update single file each time to test it.
CMD used
az webapp up --resource-group <resourcegroupname> --location <location> --plan <plan_name> --os-type Linux --runtime "python|3.9" --sku B1
You cannot update files in an App Service via Azure CLI
Source: https://learn.microsoft.com/en-us/azure/app-service/deploy-ftp?tabs=cli
Please, follow this documentation

How to set up development environment for AWS Lambda?

I wish to implement the answer that is outlined here: https://stackoverflow.com/a/50397276/1980516
However, I find that I keep running into Unable to import module 'index' at exactly this line:
const _archiver = require('archiver');
So, I'm guessing that I cannot do this via the online console. Instead, I probably have to create a deployment package.
How do I go about this? I apparently need AWS CLI, Node.js, npm and I'm new to all of it. In the Amazon docs I can't find a practical list of how to set up my local development environment.
What tools do I install, which versions and in what order exactly?
Edit: Windows :)
My guess is that you need to npm install archiver and package the node_modules dependencies along with your index.js (handler file for your lambda entry point). You can zip up and deploy/upload it to your lambda.
Also have a look at https://github.com/serverless/serverless framework, that will do these type of things easier.
Have a look at AWS SAM, the Serverless Application Model. It provides a local development setup for things like Lambda functions and API Gateway endpoints, and a way to easily package and deploy things. The exact steps you need are:
Create an AWS account and an IAM user with admin privileges
Install node.js
Install the AWS CLI (and configure it with aws configure)
Install SAM CLI and Docker (the local instances run in docker containers)
Initialize a new SAM project with sam init --runtime nodejs (or other runtime version if need)
Run through the quickstart to get an idea of how to define a SAM template, build a SAM app, and deploy.
If you don't want to use the framework or local development environment and just want to create the source bundle, there are docs. The gist is:
Install nodejs (e.g. using homebrew or an installer)
npm install the modules you need
Zip up your code including the node_modules folder
Upload the zip via the AWS Console

AWS cognito user authentication with laravel

We are trying to implement Amazon Cognito services for user authentication with our built in laravel 5.1 application. We are looking for a composer package for laravel 5.1 that allow to Amazon Cognito User Pools, registering user's into User Pools, password resets etc.
You can use AWS SDK for PHP using Composer. See the following quoted steps of this guide.
Open a terminal window and navigate to the directory where your project is stored. Composer is installed on a per-project basis.
Download and install Composer in your project directory. If you have curl installed, you can use the following command:
curl -sS https://getcomposer.org/installer | php
When the installation script finishes, a composer.phar file will be created in the directory where you ran the installer.
Create a file at the root level of your project called composer.json and add the following dependency for the AWS PHP SDK:
{
"require": {
"aws/aws-sdk-php": "2.*"
}
}
Install the dependencies by running Composer's install command:
php composer.phar install
This will create a vendor directory in your project with the required libraries and an autoloader script used to load them for your
project.
Require Composer's autoloader by adding the following line to your code's bootstrap process (typically in index.php):
require '/path/to/sdk/vendor/autoload.php';
Your code is now ready to use the AWS SDK for PHP!
AWS has added Cognito User Pools management in Version 3.32.7. You may have a look at AWS Service Provider for Laravel as well for more information.
This question is quite old, but for someone looking for such package check this out, I think this is what you need
https://github.com/black-bits/laravel-cognito-auth

boxfuse: command not found

I am integrating AWS and using boxfuse.
I set up the boxfuse account.
I install the boxfuse client.
I connect the AWS account.
When I type in terminal :- boxfuse -v, it shows me error:-
boxfuse: command not found
How to install and deploy web services on mac machine?
You need to add the Boxfuse installation directory to the PATH.
Windows: Adding directory to PATH Environment Variable in Windows
macOS: How to add /usr/local/bin in $PATH on Mac
Linux: How to permanently set $PATH on Linux?

Trouble installing AWS Elastic Beanstalk Command Line tool packages

I'm having trouble installing AWS Elastic Beanstalk command line tool and I don't understand why. I've downloaded the package from AWS and followed the instruction carefully. Following is the installation instruction:
== Installation
Once you have downloaded the CLI package:
1) Unzip this archive to a location of your choosing.
Eb is located in the "eb" directory. The complete CLI reference
for more advanced scenarios can be found in the "api" directory.
To add eb files to your path:
Linux/Mac OS X (Bash shell):
export PATH=$PATH:<path to eb>
Windows:
set PATH=<path to eb>;%PATH%
I'm using Mac OS X so I've used export PATH=$PATH:. For the path to eb, I've just copied the file into the terminal, which resulted export PATH=$PATH:/Users/lydia/Downloads/ElasticBeanstalk/eb/macosx/python2.7/eb. I'm not sure what I'm missing and I can't deploy without downloading eb command line first.
Remove the eb at the end so it's just
/Users/lydia/Downloads/ElasticBeanstalk/eb/macosx/python2.7/
this worked for me although i can only get it to work if i export the CLI into the specific website folder i am working on see my question here https://askubuntu.com/questions/428417/aws-elastic-beanstalk-command-line-tool-setup
Fix that worked for me (if you installed python using brew) is remove python via
brew uninstall --force python
and then install it again from https://www.python.org/downloads/.
Then just follow the instructions from AWS.
You only add directories to your $PATH. Is ~/Downloads/ElasticBeanstalk/eb/macosx/python2.7/eb a directory? Or is it the actual command?