Server
AWS
AWS CLI
Installation
macOS
$ brew install awscli
- Verify Installation
After installation, check the version:
$ aws --version
Linux
To install the AWS CLI, run the following commands.
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
$ unzip awscliv2.zip
$ sudo ./aws/install
To update your current installation of the AWS CLI, add your existing symlink and installer information to construct the install command using the --bin-dir
, --install-dir
, and --update
parameters. The following command block uses an example symlink of /usr/local/bin and example installer location of /usr/local/aws-cli to install the AWS CLI locally for the current user.
$ curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
$ unzip awscliv2.zip
$ sudo ./aws/install --bin-dir /usr/local/bin --install-dir /usr/local/aws-cli --update
Verify the AWS CLI by typing:
$ aws --version
Configure
$ aws configure
You’ll be prompted to enter:
- AWS Access Key ID
- AWS Secret Access Key
- Default region name (e.g., us-east-1)
- Default output format (json)
Uninstall
macOS
$ brew uninstall awscli
Commands
- List AWS CLI profiles:
$ aws configure list-profiles
IAM Certificate
List Certificates
$ aws iam list-server-certificates
Delete Certificate
Reference URL
Ensure that the certificate being deleted is not in use by any other AWS services.
$ aws iam delete-server-certificate --server-certificate-name certificate_object_name
API Gateway
Custom Domain
- Create a certificate from Amazon Certificate Manager (ACM)
- Add domain name
- Enter domain name: api.example.com
- Choose Public
- Routing mode: Choose API mappings only
- Choose the ACM certificate you just created.
- Setup API mappings by editing the new API
Usage Plans
- Open the AWS API Gateway
- Click on Usage plans on the sidebar
- Create a new usage plan with Rate / Burst and Requests settings.
Lambda
Image
- Checkout AWS Python images here
IAM Role
Attach the following permissions to the specified IAM role to grant it the necessary access for managing Amazon ECR images:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"ecr:GetAuthorizationToken",
"ecr:BatchCheckLayerAvailability",
"ecr:GetDownloadUrlForLayer",
"ecr:BatchGetImage",
"ecr:DescribeImages",
"ecr:PutImage",
"ecr:InitiateLayerUpload",
"ecr:UploadLayerPart",
"ecr:CompleteLayerUpload"
],
"Resource": "*"
}
]
}
Layers
$ aws lambda publish-layer-version \
--layer-name your_layer_name \
--zip-file fileb://layer.zip \
--compatible-runtimes python3.9 python3.10 python3.11
- Replace the function name in the following example.
- Attach this layer to your Lambda function, copy the layer Version ARN from AWS Lambda console and replace the ARN in the following example.
$ aws lambda update-function-configuration \
--function-name your-function-name \
--layers arn:aws:lambda:region:account:layer:mcp-dependencies:1