Paws is a Package for Amazon Web Services in R. Paws provides access to the full suite of AWS services from within R.
Visit our home page to see online documentation.
Disclaimer: Paws is not a product of or supported by Amazon Web Services.
Install Paws using:
If you are using Linux, you will need to install the following OS packages:
libcurl4-openssl-dev libssl-dev libxml2-dev
- CentOS/Fedora/Red Hat:
libcurl-devel libxml2-devel openssl-devel
You'll need to set up your AWS credentials and region. Paws supports setting these per-service, or using R and OS environment variables, AWS credential files, and IAM roles. See docs/credentials.md for more info.
In the example below, we set them with R environment variables.
Warning: Do not save your credentials in your code, which could reveal them to others. Use one of the other methods above instead. See also RStudio's best practices for securing credentials.
Sys.setenv( AWS_ACCESS_KEY_ID = "abc", AWS_SECRET_ACCESS_KEY = "123", AWS_REGION = "us-east-1" )
To use a service, create a client. All of a service's operations can be accessed from this object.
ec2 <- paws::ec2()
Launch an EC2 instance using the
resp <- ec2$run_instances( ImageId = "ami-f973ab84", InstanceType = "t2.micro", KeyName = "default", MinCount = 1, MaxCount = 1, TagSpecifications = list( list( ResourceType = "instance", Tags = list( list(Key = "webserver", Value = "production") ) ) ) )
List all of your instances with
Shut down the instance you started with
ec2$terminate_instances( InstanceIds = resp$Instances[]$InstanceId )
You can browse all available services by looking at the package documentation.
help(package = "paws")
You can also jump to a specific service and see all its operations.
RStudio's code completion will show you the available services, their operations, and each operation's parameters.