VishaalY/solutions-architect-hf-dataset huggingface dataset:
Question: How do I troubleshoot Lambda synchronous invocation issues?

I’ve set up an AWS Lambda function to invoke synchronously but the destination isn’t initiating. How do I fix this issue?When I invoke a Lambda function through the Lambda console does it get invoked synchronously or asynchronously?-or-Why isn't my Lambda function retrying after I set it to retry one or two more times?ResolutionWhen you synchronously invoke a Lambda function and it fails, the following are possible causes:Lambda doesn’t have permission to perform the actions included in the code.The AWS service that invokes the Lambda function doesn’t have sufficient permissions.Lambda is invoked asynchronously.Lambda supports destinations only for asynchronous invocations and stream invocations, and not for synchronous invocations.Follow these steps to troubleshoot synchronous invocation issues:1.    Determine how the Lambda function is invoked. Is the function invoked using AWS CLI? Is the function invoked through an AWS service?2.    Check whether the AWS service invokes the Lambda function synchronously or asynchronously.3.    Invoke the Lambda function synchronously by using the following command:aws lambda invoke --function-name my-function --cli-binary-format raw-in-base64-out --payload '{ "key": "value" }' response.jsonSee if a 200 status code is reported or if the command returns an error.4.    Remember that Lambda function retry behavior is controlled by the client in synchronous invocations. The Retry attempts configuration from the AWS Lambda console is limited to asynchronous invocations. Make sure that the client retries the requests rather than checking the Lambda logs.5.    Remember that a Lambda function invoked in the Lambda console is always a synchronous invocation.6.    Synchronous invocation retry behavior varies between AWS services, based on each service's event source mapping.For more information, see Event-driven invocation.7.    Make sure that the Lambda function's code is idempotent and can handle the same messages multiple times.8.    Identify and resolve any errors that your Lambda function returns.For more information, see How do I troubleshoot Lambda function failures?9.    If you still can’t resolve the issue, open a case with AWS Support. Provide the following information in the case:The Lambda function ARN.The workflow on the Lambda function setup with all included services.Details about whether the issue is intermittent or continuous.Complete CloudWatch logs in .txt format from when the issue occurred. These CloudWatch logs are used to identify Lambda function errors that include timeout issues, init durations, and permissions issues.The exact timestamp of the issue with the timezone or timestamp in UTC.Note: AWS Support representatives don’t have access to customer CloudWatch logs due to security and privacy reasons.

Related informationComparing Lambda invocation modesInvoking Lambda functionsIntroducing AWS Lambda Destinations
Question: Why do I get a “The provided token is malformed or otherwise invalid” error when I launch an Amazon EMR cluster using Hive and Presto in the AWS China (Beijing) Region?

I launched an Amazon EMR cluster in the AWS China (Beijing) Region (cn-north-1). I used Presto and Apache Hive to create an external table from an Amazon Simple Storage Service (Amazon S3) bucket. When I query the table using Hive and Presto, I get an error similar to the following:presto:default> select * from mydata;Query 20200912_072348_00009_qqx96, FAILED, 1 nodeSplits: 1 total, 0 done (0.00%)0:03 [0 rows, 0B] [0 rows/s, 0B/s]Query 20200912_072348_00009_qqx96 failed: The provided token is malformed or otherwise invalid. (Service: Amazon S3; Status Code: 400; Error Code: InvalidToken; Request ID: 811359ED1D9F8250)

Short descriptionIn earlier Amazon EMR release versions, Presto doesn't automatically use the Region that the S3 bucket is in. Use one of the following options to resolve this error:Upgrade to Amazon EMR release version 5.12.0 or later.To use Amazon EMR release version 5.11.x or earlier, set the hive.s3.pin-client-to-current-region property to true.

ResolutionUpgrade to Amazon EMR release version 5.12.0 or laterLaunch a new cluster and choose Amazon EMR release version 5.12.0 or later. For more information, see About Amazon EMR releases.Set hive.s3.pin-client-to-current-region property to true (version 5.11.x or earlier)1.    On each node, open the hive.properties file and then set the hive.s3.pin-client-to-current-region property to true. Example:sudo vim /etc/presto/conf/catalog/hive.propertieshive.s3.connect-timeout=2mhive.s3.max-backoff-time=10m...hive.s3.pin-client-to-current-region=true2.    Restart Presto on each node:sudo restart presto-server3.    To confirm that the new configuration works as expected, query a table using Hive and Presto in the China (Beijing) Region.

Related informationApache HivePresto and Trino
Question: Why am I getting the error "VolumeInUse" when trying to attach an Amazon EBS io2 Block Express volume to my EC2 instance?

I'm trying to attach an Amazon Elastic Block Store (Amazon EBS) io2 Block Express volume to my Amazon Elastic Compute Cloud (Amazon EC2) instance. The volume is in the "available" state, but I get the following error:"An error occurred (VolumeInUse) when calling the AttachVolume operation: vol-xxxx is already attached to an instance".

ResolutionYou receive this error when you try to attach an io2 Block Express volume to an EC2 instance type that doesn't support this volume type. To resolve this issue, check whether the EC2 instance type that you're attaching the volume to supports io2 Block Express volumes.The following instance types support io2 Block Express volumes:c6inc7gm6inm6idnr5br6inr6idntrn1x2idnx2iednFor more information, see io2 Block Express volumes.
Question: How can I troubleshoot an AWS DMS task that failed with a foreign key constraint violation error?

I have an AWS Database Migration Service (AWS DMS) task that fails with a foreign key constraint violation.Short DescriptionBy default, AWS DMS tasks load eight tables at a time during the full load phase. These tables load alphabetically by default, unless you configure the loading order for the task. For more information, see Tables load order during full load in AWS Database Migration Service improves migration speeds by adding support for parallel full load and new LOB migration mechanisms.If you don't configure the load order to load parent tables first, then a child table might load before its parent table. This causes the task to fail with a foreign key constraint violations error. In this case, you see log entries that are similar to the following examples:[TARGET_LOAD ]E: RetCode: SQL_ERROR SqlState: 0A000 NativeError: 1 Message: ERROR: cannot truncate a table referenced in a foreign key constraint; Error while executing the query [1022502] (ar_odbc_stmt.c:4622)[TARGET_LOAD ]E: RetCode: SQL_ERROR SqlState: HY000 NativeError: 1217 Message: [MySQL][ODBC 5.3(w) Driver][mysqld-5.7.23-log]Cannot delete or update a parent row: a foreign key constraint fails [1022502] (ar_odbc_stmt.c:4615)Ongoing replication uses the Transactional Apply mode that applies the transactions in the same commit order as the source. When the task is in the ongoing replication phase, you can activate foreign key constraints on the target. If you use Batch Apply mode for ongoing replication, then you must deactivate the foreign keys, even during the change data capture (CDC) phase.

ResolutionTo resolve this error, complete either of the following steps:Deactivate foreign key constraintsUse Drop tables on target modeDeactivate foreign key constraintsIf the target is a MySQL-compatible database, then you can use extra connection attributes to deactivate foreign key constraints:initstmt=SET FOREIGN_KEY_CHECKS=0If the target is a PostgreSQL-compatible database, then you see foreign key violation errors during the CDC phase. To resolve this error, set the session_replication_role parameter to replica. To do this, add the extra connection attribute afterConnectScript=SET session_replication_role='replica' to the endpoint. Or, use the AWS Command Line Interface to add endpoint settings to the target endpoint.For other databases engines, manually deactivate or drop foreign key constraints.Note: If you receive errors when running AWS CLI commands, make sure that you’re using the most recent version of the AWS CLI.Use Drop tables on target modeWhen you use Drop tables on target mode, AWS DMS creates only objects that are necessary for a full load to succeed on the target. AWS DMS also refers to this as the DROP_AND_CREATE task setting. However, if you use Drop tables on target mode, then you must manually create other objects outside of AWS DMS. This includes objects such as secondary indexes, data defaults, and triggers.Related InformationUsing the task log to troubleshoot migration issues
Question: Why does a subnet that load balancers use in my VPC have insufficient IP addresses?

A subnet in my virtual private cloud (VPC) ran out of available IP addresses, and I'm using this subnet with Elastic Load Balancing load balancers.

Short descriptionIf subnets in your VPC run out of available IP addresses, then AWS resources, such as load balancers, might not respond to increased traffic.It's a best practice to keep at least eight IP addresses available in each subnet. There are two ways to free up or add IP addresses to use with load balancers. The following methods apply to both Application Load Balancers and Classic Load Balancers:Delete unused elastic network interfaces to free up IP addresses in the subnet.Create and add a new subnet to your VPC.Note: Load balancers can have only one subnet per Availability Zone. Review the other requirements for subnets on a load balancer.

ResolutionDelete unused elastic network interfacesTo delete an unused elastic network interface, see Delete a network interface.Add a new subnet with available IP addresses for your load balancerCreate and add a new subnet to your VPC.Note: You can create a new subnet using the VPC's original CIDR blocks. You can also add CIDR blocks to your VPC to use with the new subnet.Replace your old subnet with the new subnet. For Classic Load Balancers, see Add a subnet. For Application Load Balancers, see Availability Zones for your Application Load Balancer.Check the route tables and network access control list (network ACL) rules that are associated with your subnet. Make sure that your new subnet routes traffic the same way that your previous subnet did. For example, if you configured a default route to an internet gateway in your previous subnet, then make sure that your new subnet has a similar route.(Optional) As a best practice, turn on cross-zone load balancing.

Related informationTutorial: Create a Classic Load BalancerTutorial: Create an Application Load Balancer using the AWS Command Line Interface (AWS CLI)
Question: How do I access a private API Gateway API when the VPC endpoint uses an on-premises DNS?

I'm using a virtual private cloud (VPC) that has a custom, on-premises Domain Name System (DNS) server. After creating a VPC endpoint for a private Amazon API Gateway API, I received a name-resolution error when I tried to invoke the API. How do I fix this issue?ResolutionTo troubleshoot name-resolution errors from API Gateway when the VPC endpoint uses an on-premises DNS, do the following:1.    Create an Amazon Route 53 Resolver in the VPC. For more information, see Getting started with Route 53 Resolver.Note: Creating a Route 53 Resolver in the VPC allows the Route 53 Resolver to resolve the VPC endpoint's hostname within the VPC.2.    Add a DNS forwarder to the on-premises DNS server. When you configure the DNS forwarder, do the following:Configure the DNS forwarder so that it forwards DNS queries to the Route 53 Resolver you created in step 1.Add a rule to the DNS forwarder that allows it to forward only DNS queries that end with amazonaws.com. (The domain name of the VPC endpoint.)For more information, see Considerations when creating inbound and outbound endpoints.Note: You must have the DNS forwarder's destination IP addresses to configure the DNS forwarder.To get the DNS forwarder's destination IP addresses1.    Open the Route 53 console.2.    In the left navigation panel, in the Resolver section, choose Inbound endpoints.3.    Open the Details page of the inbound endpoint for the VPC.4.    Note the IP addresses listed in the IP addresses section of the resolver. These are the DNS forwarder's destination IP addresses.Note: The steps to create a DNS forwarder for an on-premises DNS server are different for each DNS server. For more information, consult your on-premises DNS server manual.

Related informationRoute 53 Resolver for hybrid cloudsResolving DNS queries between VPCs and your network
Question: Why can't I access my S3 bucket when using the Hue S3 File Browser in Amazon EMR?

I'm using Hue (Hadoop User Experience) to access Amazon Simple Storage Service (Amazon S3) buckets on an Amazon EMR cluster. I'm getting one of the following error messages:There are no files matching the search criteria.Failed to access path "s3a://awsdoc-example-bucket.hue1": hostname u'awsdoc-example-bucket.hue1.s3.amazonaws.com' doesn't match either of '.s3.amazonaws.com', 's3.amazonaws.com'Failed to retrieve bucket: hostname u'awsdoc-example-bucket.hue1.s3.amazonaws.com' doesn't match either of '.s3.amazonaws.com', 's3.amazonaws.com'Short descriptionThe default Amazon S3 calling format for Hue is https://awsdoc-example-bucket.s3.amazonaws.com. If there is a dot (.) in your S3 bucket name, part of the bucket name is included in the Amazon S3 endpoint. For example, if your bucket is named awsdoc-example-bucket.hue, then Hue treats hue.s3.amazonaws.com as the Amazon S3 endpoint instead of s3.amazonaws.com.

ResolutionTo resolve this error, change the endpoint format to  https://s3.amazonaws.com/awsdoc-example-bucket. When you use this format, you can have as many dots in your bucket name as you want.1.    Open the /etc/boto.cfg file.2.    Add the following lines to the boto.cfg file:[s3]calling_format=boto.s3.connection.OrdinaryCallingFormat3.    Restart the Hue service:For Amazon EMR versions earlier than 5.30:$ sudo stop hue$ sudo start hueFor Amazon EMR versions 5.30 and later:$ sudo systemctl restart hue

Related informationBoto3 configurationHue
Question: Why is my Lambda function batch size smaller than the configured batch size?

When processing Amazon Kinesis Data Streams, my AWS Lambda function's batch size is smaller than the batch size that I configured. Why is my Lambda function receiving fewer records per invocation than the batch size that I configured in my Amazon Kinesis event source?ResolutionThe batch size that you set when configuring a Kinesis event source determines the maximum batch size that your Lambda function can process. The batch size that your function processes when it's invoked by a Kinesis event source can be lower than the batch size that you configure.Four values determine the batch size that your Lambda function processes when it's invoked by a Kinesis event source:The maximum batch size limit that you set when configuring your Kinesis event source.The number of records received from the GetRecords action that Lambda makes when polling your event source.The number of records that can fit within the 6 MB Lambda invocation payload size limit.Note: A larger record size means that fewer records can fit in the payload.The amount of data in your Kinesis Data Streams.Note: If the traffic on your Kinesis Data Streams is low, then the batch size that your function processes will be smaller.To calculate the approximate batch size that your function will process, use the following formula:6000 KB Lambda invocation payload size limit ÷ The size of an individual record in your batch (in KB) = Approximate number of records processed for each batchFor example, if each record in your batch is 64 KB, you can expect your function to process about 90 records per batch.

Related informationUsing AWS Lambda with Amazon KinesisWorking with streams
Question: How do I terminate an Amazon EMR cluster?

I want to terminate one or more Amazon EMR clusters using the Amazon EMR console.

ResolutionAn Amazon EMR cluster can be configured with termination protection. For more information, see Using termination protection.To terminate a cluster with or without termination protection, do the following:Terminate a cluster with termination protection offAccess the Amazon EMR console.Select the AWS Region for your Amazon EMR cluster.Select the cluster or clusters to terminate. You can terminate multiple clusters at the same time.Choose Terminate.When prompted, choose Terminate.Terminate a cluster with termination protection onAccess the Amazon EMR console.Select the AWS Region for your Amazon EMR cluster.On the Cluster List page, select the cluster or clusters to terminate. You can terminate multiple clusters at the same time.Choose Terminate.When prompted, choose Change to turn termination protection off. If you selected multiple clusters, then choose Turn off all to turn off termination protection for all the clusters at once.In Terminate clusters, for Termination Protection, choose Off. Then, select the check box to confirm.Choose Terminate.Amazon EMR terminates the instances in the cluster and stops saving log data.You can also terminate a cluster using the AWS CLI or API, for more information, see Terminate a cluster.
Question: How do I allocate memory to work as swap space on an Amazon EC2 instance using a partition on my hard drive?

I want to allocate memory to work as swap space on an Amazon Elastic Compute Cloud (Amazon EC2) instance using a partition on my hard drive. How do I do that?Short descriptionTo allocate memory as swap space, do the following:1..    Calculate the swap space size.2..    Create a partition on your hard disk as swap space.3..    Set up the swap area.You can also create a swap file to use as a swap space. For more information, see How do I allocate memory to work as swap space in an Amazon EC2 instance by using a swap file?Note: The instance uses swap space when the amount of RAM is full. Swap space can be used for instances that have a small amount of RAM, but isn't a replacement for more RAM. Because swap space is located on the instance's hard drive, performance is slower when compared to actual RAM. For more or faster memory, consider increasing your instance size.

ResolutionCalculate the swap space sizeIt's a best practice that swap space is equal to 2 times the physical RAM, for up to 2 GB of physical RAM. For any amount above 2 GB, add an additional 1x physical RAM. It's a best practice that swap space is never less than 32 MB.Amount of system RAMRecommended swap space2 GiB of RAM or less2 times the amount of RAM but never less than 32 MBMore than 2 GiB of RAM but less than 64 GiB0.5 times the amount of RAMMore than 64 GiBDepends on the workload or use caseCreate a partition on your hard drive as swap space1..    Log in to the instance using SSH.2..    List the available volumes:$ sudo fdisk -l3..    Select a device to partition from the list. In this example, use the device /dev/xvda.$ sudo fdisk /dev/xvda4..    Create a new partition:-> n5..    Select a partition type. In this example, use primary:-> p6..    Assign the partition number. In this example, use partition 2:-> 27..    Accept the default of "First sector" by pressing Enter.8..    Enter the size of the swap file. For this example, there is 2 GB of RAM, and the partition created is 4 GB (specified as +4G).-> +4G9..    Save and exit:-> wSet up the swap area1..    Use the partprobe command to inform the OS of partition table change:$ partprobe2..    Set up a Linux swap area using the swap partition you created in the preceding steps. In this example, the swap partition is /dev/xvda2.$ mkswap /dev/xvda23..    Add the partition as swap space:$ sudo swapon /dev/xvda24..    Show the current swap space:$ sudo swapon -sOutput similar to the following appears:Filename                Type        Size      Used    Priority/dev/xvda2              partition   4194300   0       -15..    Make the swap memory allocation permanent after reboot with the following command:Note: If xvda2 isn't your swap device name, then replace this term with the swap device name in your environment.$ cp /etc/fstab /etc/fstab_$(date +%Y%m%d%H%M%S)$ cat <<EOF >> /etc/fstab`sudo blkid /dev/xvda2 | grep -Eo '[[:alnum:]]{8}(-[[:alnum:]]{4}){3}-[[:alnum:]]{12}'` swap swap defaults 0 0EOF$ reboot

Related informationSwap space
Question: How do I resolve the "Route did not stabilize in expected time" error in AWS CloudFormation?

I tried to create an AWS CloudFormation stack, but the stack failed. Then, I received the following error message: "Route did not stabilize in expected time." How do I resolve this error?Short descriptionYou must specify one of the following targets for the route assigned to your route table in your Amazon Virtual Private Cloud (Amazon VPC):Internet gateway or virtual private gatewayNAT instanceNAT gatewayVPC peering connectionNetwork interfaceEgress-only internet gatewayIf you set any property of your AWS::EC2::Route type (your target) to an incorrect value, then you receive the "Route did not stabilize in expected time" error.For example, you receive this error if you incorrectly set the value of the NatGatewayId property to the GatewayId property, as shown in the following code example:MyRoute ": {  "Type": "AWS::EC2::Route",  "Properties": {    "DestinationCidrBlock": "0.0.0.0/0",    "GatewayId": "nat-0a12bc456789de0fg",    "RouteTableId": {      "Ref": "MyRouteTable"    }  }}ResolutionAssign the correct value to the corresponding property. See the following examples:"GatewayId" : "igw-eaad4883"-or-"NatGatewayId" : "nat-0a12bc456789de0fg"For more information on a stack failure, check the AWS CloudTrail events that correspond to the failure.
Question: How do I allow agents in my Amazon Connect contact center to transfer contacts using the CCP?

I want agents in my Amazon Connect contact center to be able to transfer contacts using the Amazon Connect Contact Control Panel (CCP).

ResolutionTo let agents in your Amazon Connect contact center use the CCP to transfer contacts, use quick connects. Complete the steps in the following sections to set up quick connects for your queues.Create or edit Agent, Queue, or External quick connects based on the type of transfer that you're usingNote: Configured Agent and Queue quick connects appear in the CCP only when an agent is on an active contact. External quick connects appear in the CCP at all times.Use your access URL to log in to your Amazon Connect instance (https://domain.awsapps.com/connect/login -or https://domain.my.connect.aws).Important: You must log in as a user that has Edit and Create permissions for quick connects. For more information, see Security profiles.Follow the instructions in Create quick connects.Add the quick connect to the queues that you use in your contact flowsFollow the instructions in Allow agents to see quick connects.Add the queues to your agents' routing profileConfirm that the queues that include your activated quick connects are in a routing profile assigned to the agents who will use the quick connects.For more information, see Set up routing.Important: For quick connects to appear in the CCP, confirm that you correctly configured the routing.

Related informationSet up contact transfersHow routing worksCreate a routing profileCreate a new flow